aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-11-12 01:39:29 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-11-13 06:23:57 +0100
commit3aa5593af18bd4925235d1820fd0fe7c646843aa (patch)
tree717aa3b1f6ffb2685a901f42f6a89fd6936c7c84 /tests
parentc3bf5d306ff1396d6117774316afd998f6e9874a (diff)
Net::IMAP::InterIMAP::push_flag_updates() bugfixes.
The UNCHANGEDSINCE test from the CONDSTORE extension was incorrectly placed after the flag list in UID STORE commands. In practice this meant the server didn't add the MODIFIED code when needed. The server won't send an untagged FETCH command (and won't increase the message's MODSEQ) if no change was made to the flag list. A panic() was incorrectly triggered in that case. When the flag list was set (by another client) to a superset of the UID STORE command currently processed, the extra flags were not synchronized. Cf. RFC 7162 sec. 3.1.3 ex. 10.
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