aboutsummaryrefslogtreecommitdiffstats
path: root/tests/list-reference
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-11-13 06:24:07 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-11-13 06:24:07 +0100
commitc6bbdd8aa697b2d42be1ac0839189da32d437a8f (patch)
treecd1b8d19d99557fbebe33344d0d23f6ac826da57 /tests/list-reference
parent87d947df1b837514a0f1efa3bc36b58088bd2564 (diff)
parentdac4ab1c9306bf2035bc1547d2ed27ab09850120 (diff)
Merge branch 'master' into debian
Diffstat (limited to 'tests/list-reference')
-rw-r--r--tests/list-reference/interimap.local1
-rw-r--r--tests/list-reference/interimap.remote1
-rw-r--r--tests/list-reference/local.conf3
-rw-r--r--tests/list-reference/remote.conf3
-rw-r--r--tests/list-reference/t47
5 files changed, 55 insertions, 0 deletions
diff --git a/tests/list-reference/interimap.local b/tests/list-reference/interimap.local
new file mode 100644
index 0000000..a013813
--- /dev/null
+++ b/tests/list-reference/interimap.local
@@ -0,0 +1 @@
+list-reference = foo/
diff --git a/tests/list-reference/interimap.remote b/tests/list-reference/interimap.remote
new file mode 100644
index 0000000..f34119c
--- /dev/null
+++ b/tests/list-reference/interimap.remote
@@ -0,0 +1 @@
+list-reference = bar\
diff --git a/tests/list-reference/local.conf b/tests/list-reference/local.conf
new file mode 100644
index 0000000..93e4860
--- /dev/null
+++ b/tests/list-reference/local.conf
@@ -0,0 +1,3 @@
+namespace inbox {
+ separator = /
+}
diff --git a/tests/list-reference/remote.conf b/tests/list-reference/remote.conf
new file mode 100644
index 0000000..9657e89
--- /dev/null
+++ b/tests/list-reference/remote.conf
@@ -0,0 +1,3 @@
+namespace inbox {
+ separator = "\\"
+}
diff --git a/tests/list-reference/t b/tests/list-reference/t
new file mode 100644
index 0000000..a2cc9c7
--- /dev/null
+++ b/tests/list-reference/t
@@ -0,0 +1,47 @@
+# create and populate some mailboxes in and out the respective list references
+doveadm -u "local" mailbox create "foo" "foobar" "foo/bar/baz" "foo/baz" "bar" "bar/baz"
+doveadm -u "remote" mailbox create "foo" "foobaz" "foo/baz" "foo\\baz" "bar\\baz" "bar\\!"
+
+populate() {
+ local i
+ for ((i = 0; i < 32; i++)); do
+ m="$(shuf -n1 -e -- "foo" "foobar" "foo/bar/baz" "foo/baz" "bar" "bar/baz")"
+ sample_message | deliver -u "local" -- -m "$m"
+
+ m="$(shuf -n1 -e -- "foo" "foobar" "foo/baz" "foo\\baz" "bar\\baz" "bar\\!")"
+ sample_message | deliver -u "remote" -- -m "$m"
+ done
+}
+populate
+
+interimap_init
+grep -Fx "database: Created mailbox bar/baz" <"$STDERR" || error
+grep -Fx "database: Created mailbox baz" <"$STDERR" || error
+grep -Fx "database: Created mailbox !" <"$STDERR" || error
+grep -Fx "local: Created mailbox foo/!" <"$STDERR" || error
+grep -Fx "remote: Created mailbox bar\\bar\\baz" <"$STDERR" || error
+
+verify() {
+ # check that the mailbox lists match
+ diff -u --label="local/mailboxes" --label="remote/mailboxes" \
+ <( doveadm -u "local" mailbox list | sed -n 's,^foo/,,p' | sort ) \
+ <( doveadm -u "remote" mailbox list | sed -n 's,^bar\\,,p' | tr '\\' '/' | sort ) \
+ || error "mailbox lists differ"
+
+ for m in "bar/baz" "baz" "!"; do
+ blob="x'$(printf "%s" "$m" | tr "/" "\\0" | xxd -c256 -u -ps)'"
+ check_mailbox_status2 "$blob" "foo/$m" "remote" "bar\\${m//\//\\}"
+ done
+}
+verify
+
+# add more messages and re-check
+populate
+interimap || error
+verify
+
+# double check that mailboxes outside references weren't created
+! doveadm -u "local" mailbox status uidvalidity "foobaz" || error
+! doveadm -u "remote" mailbox status uidvalidity "foobar" || error
+
+# vim: set filetype=sh :