aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/condstore/t50
-rw-r--r--tests/list1
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/condstore/t b/tests/condstore/t
new file mode 100644
index 0000000..d4da50f
--- /dev/null
+++ b/tests/condstore/t
@@ -0,0 +1,50 @@
+TIMEOUT=60
+N=4096
+
+# test CONDSTORE/QRESYNC (behavior) in UID STORE commands, in particular
+# the UNCHANGEDSINCE test: populate, keep assiging keywords at random,
+# and make sure interimap is able to reconciliate the changes
+
+# populate (with dummy messages to speed things up) only one server
+# before initializing interimap, so UIDs concide with sequence numbers
+# and are identical on both servers
+for ((i = 0; i < N; i++)); do
+ deliver -u "local" <<< .
+done
+
+interimap_init
+
+# assign a set of 16 tags; not more because in order to maximize the
+# likelyhood of conflicts we want UID STORE commands to use large sets
+declare -a FLAGS=(0 1 2 3 4 5 6 7 8 9 a b c d e f)
+
+# start a long-lived interimap process
+interimap --watch=1 & PID=$!
+trap "ptree_abort $PID" EXIT INT TERM
+
+timer=$(( $(date +%s) + TIMEOUT ))
+while [ $(date +%s) -le $timer ]; do
+ a="$(shuf -n1 -e "add" "remove" "replace")"
+ u="$(shuf -n1 -e "local" "remote")"
+ f="$(shuf -n1 -e "${FLAGS[@]}")"
+ seqs="$(shuf -n$((N/8)) -i1-$N)" # trigger changes on 1/8 of all messages
+ doveadm -u "$u" flags "$a" "$f" mailbox "INBOX" "${seqs//$'\n'/,}"
+ sleep "0.0$(shuf -n1 -i10-99)" # 10 to 99ms
+done
+sleep 2
+
+ptree_abort $PID
+trap - EXIT INT TERM
+
+# make sure the list of uids for a given tag match
+flagged_uids() {
+ local u="$1" f="$2"
+ doveadm -u "$u" search mailbox "INBOX" keyword "$f" | cut -d" " -f2 | sort -n
+}
+for f in "${FLAGS[@]}"; do
+ diff --label="local/$f" --label="remote/$f" -u -- \
+ <(flagged_uids "local" "$f") <(flagged_uids "remote" "$f") ||
+ error "UID list differs for keyword '$f'"
+done
+
+# vim: set filetype=sh :
diff --git a/tests/list b/tests/list
index 9ce0c06..8bb4478 100644
--- a/tests/list
+++ b/tests/list
@@ -39,6 +39,7 @@ repair --repair
auth-noplaintext abort when STARTTLS is not offered
compress COMPRESS=DEFLATE
+condstore CONDSTORE
. SSL/TLS
starttls-logindisabled LOGINDISABLED STARTTLS