aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-12-13 04:43:43 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-12-13 20:05:11 +0100
commit0dfcd073ffc391ca38b523a8d43e3f9479bb14c1 (patch)
treecbffd8c62a5b66862d10191fc3973bc13b996581
parent5887789cb28ba863ad8c392e5b7bc79afe15001c (diff)
New test for hierarchy delimiter change.
Cf. https://www.imapwiki.org/ClientImplementation/MailboxList#Hierarchy_separators “Some clients cache the hierarchy separator forever. This has problems if the server configuration is changed (e.g. server software changed). Try to avoid this problem.”
l---------tests/delimiter-change/local.conf1
l---------tests/delimiter-change/remote.conf1
-rw-r--r--tests/delimiter-change/t37
-rw-r--r--tests/list1
4 files changed, 40 insertions, 0 deletions
diff --git a/tests/delimiter-change/local.conf b/tests/delimiter-change/local.conf
new file mode 120000
index 0000000..3f516c5
--- /dev/null
+++ b/tests/delimiter-change/local.conf
@@ -0,0 +1 @@
+../list-mailbox/local.conf \ No newline at end of file
diff --git a/tests/delimiter-change/remote.conf b/tests/delimiter-change/remote.conf
new file mode 120000
index 0000000..f0cf1d7
--- /dev/null
+++ b/tests/delimiter-change/remote.conf
@@ -0,0 +1 @@
+../list-mailbox/remote.conf \ No newline at end of file
diff --git a/tests/delimiter-change/t b/tests/delimiter-change/t
new file mode 100644
index 0000000..3f96953
--- /dev/null
+++ b/tests/delimiter-change/t
@@ -0,0 +1,37 @@
+# create and populate some mailboxes
+doveadm -u "local" mailbox create -- "foo" "foo.bar" "baz"
+
+run() {
+ local i m u s1="$1" s2="$2" m2
+ for ((i = 0; i < 16; i++)); do
+ m="$(shuf -n1 -e -- "foo" "foo${s1}bar" "baz" "INBOX")"
+ u="$(shuf -n1 -e -- "local" "remote")"
+ [ "$u" = "local" ] && m2="$m" || m2="${m//"$s1"/$s2}"
+ sample_message | deliver -u "$u" -- -m "$m2"
+ done
+ interimap --debug
+ grep -Fxq "local: Using \"$s1\" as hierarchy delimiter" <"$STDERR" || error
+ grep -Fxq "remote: Using \"$s2\" as hierarchy delimiter" <"$STDERR" || error
+ check_mailbox_list "foo" "foo${s1}bar" "baz" "INBOX"
+ check_mailboxes_status "foo" "foo${s1}bar" "baz" "INBOX" || error
+}
+
+run "." "?"
+
+# make sure interimap doesn't choke when the hierarchy delimiter changes
+# cf. https://www.imapwiki.org/ClientImplementation/MailboxList#Hierarchy_separators
+sed -ri "s,^(\\s*separator\\s*)=.*,separator = /," "$HOME_remote/.dovecot/config"
+run "." "/"
+
+sed -ri "s,^(\\s*separator\\s*)=.*,separator = /," "$HOME_local/.dovecot/config"
+run "/" "/"
+
+sed -ri "s,^(\\s*separator\\s*)=.*,separator = .," "$HOME_local/.dovecot/config"
+sed -ri "s,^(\\s*separator\\s*)=.*,separator = .," "$HOME_remote/.dovecot/config"
+run "." "."
+
+# ensure there were no duplicates
+n="$(doveadm -u "local" search all | wc -l)"
+[ "$n" -eq 64 ] || error "$n != 64"
+
+# vim: set filetype=sh :
diff --git a/tests/list b/tests/list
index 52417c1..402ec51 100644
--- a/tests/list
+++ b/tests/list
@@ -27,6 +27,7 @@ largeint Large UIDVALIDITY/UIDNEXT/HIGHESTMODSEQ values
list-mailbox list-mailbox = foo "foo bar" "f\\\"o\x21o.*" "f\0o\0o"
list-select-opts list-select-opts = SUBSCRIBED
ignore-mailbox ignore-mailbox = ^virtual(?:\x00|$)
+ delimiter-change doesn't choke on delimiter change
resume Resume when aborted
repair --repair