diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2019-11-09 03:13:45 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2019-11-13 06:23:56 +0100 |
commit | 67440844c422ee30b31df9a46a7f99ac0e833add (patch) | |
tree | 989381e5b94d5939dafdd1e99c7db2ada95355ec /tests/01-rename | |
parent | b9da6cc7ecf71026d1023dc3354b820c7518426e (diff) |
Refactor and improve test suite.
Diffstat (limited to 'tests/01-rename')
-rw-r--r-- | tests/01-rename/local.conf | 6 | ||||
-rw-r--r-- | tests/01-rename/remote.conf | 6 | ||||
-rw-r--r-- | tests/01-rename/run | 84 |
3 files changed, 0 insertions, 96 deletions
diff --git a/tests/01-rename/local.conf b/tests/01-rename/local.conf deleted file mode 100644 index 93497d9..0000000 --- a/tests/01-rename/local.conf +++ /dev/null @@ -1,6 +0,0 @@ -namespace inbox { - separator = . - location = maildir:~/inbox:LAYOUT=index - inbox = yes - list = yes -} diff --git a/tests/01-rename/remote.conf b/tests/01-rename/remote.conf deleted file mode 100644 index cc6781d..0000000 --- a/tests/01-rename/remote.conf +++ /dev/null @@ -1,6 +0,0 @@ -namespace inbox { - separator = ^ - location = maildir:~/inbox:LAYOUT=index - inbox = yes - list = yes -} diff --git a/tests/01-rename/run b/tests/01-rename/run deleted file mode 100644 index 6541c5c..0000000 --- a/tests/01-rename/run +++ /dev/null @@ -1,84 +0,0 @@ -doveadm -u "local" mailbox create "root.from" "root.from.child" "root.from.child2" "root.from.child.grandchild" -doveadm -u "remote" mailbox create "root^sibbling" "root^sibbling^grandchild" "root2" - -for m in "root.from" "root.from.child" "root.from.child2" "root.from.child.grandchild" "INBOX"; do - sample_message | deliver -u "local" -- -m "$m" -done -for m in "root^sibbling" "root^sibbling^grandchild" "root2" "INBOX"; do - sample_message | deliver -u "remote" -- -m "$m" -done - -interimap -check_mailboxes_status "root.from" "root.from.child" "root.from.child2" "root.from.child.grandchild" \ - "root.sibbling" "root.sibbling.grandchild" "root2" "INBOX" -sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/mailboxes.csv" <<-EOF - .mode csv - SELECT idx, hex(mailbox) - FROM mailboxes - ORDER BY idx -EOF - -# renaming a non-existent mailbox doesn't yield an error -interimap --rename "nonexistent" "nonexistent2" -check_mailbox_list - -# renaming to an existing name yields an error -! interimap --rename "root2" "root" -xgrep -E "^local: ERROR: Couldn't rename mailbox root2: NO \[ALREADYEXISTS\] .*" <"$STDERR" - -# rename 'root.from' to 'from.root', including inferiors -interimap --rename "root.from" "from.root" -xgrep -Fx 'local: Renamed mailbox root.from to from.root' <"$STDERR" -xgrep -Fx 'remote: Renamed mailbox root^from to from^root' <"$STDERR" -xgrep -Fx 'database: Renamed mailbox root.from to from.root' <"$STDERR" - -check_mailbox_list -check_mailboxes_status "from.root" "from.root.child" "from.root.child2" "from.root.child.grandchild" \ - "root.sibbling" "root.sibbling.grandchild" "root2" "INBOX" - -before="$(printf "%s\\0%s" "root" "from" | xxd -u -ps)" -after="$(printf "%s\\0%s" "from" "root" | xxd -ps)" -sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/mailboxes2.csv" <<-EOF - .mode csv - SELECT idx, - CASE - WHEN mailbox = x'$after' OR hex(mailbox) LIKE '${after}00%' - THEN '$before' || SUBSTR(hex(mailbox), $((${#after}+1))) - ELSE hex(mailbox) - END - FROM mailboxes - ORDER BY idx -EOF -diff -u --label="a/mailboxes.csv" --label="b/mailboxes.csv" \ - "$TMPDIR/mailboxes.csv" "$TMPDIR/mailboxes2.csv" - - -# Try to rename \NonExistent root and check that its children move -interimap --rename "root" "newroot" -xgrep -Fq 'local: Renamed mailbox root to newroot' <"$STDERR" -xgrep -Fq 'remote: Renamed mailbox root to newroot' <"$STDERR" -xgrep -Fq 'database: Renamed mailbox root to newroot' <"$STDERR" - -check_mailbox_list -check_mailboxes_status "from.root" "from.root.child" "from.root.child2" "from.root.child.grandchild" \ - "newroot.sibbling" "newroot.sibbling.grandchild" "root2" "INBOX" - -before2="$(printf "%s" "root" | xxd -u -ps)" -after2="$(printf "%s" "newroot" | xxd -ps)" -sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/mailboxes3.csv" <<-EOF - .mode csv - SELECT idx, - CASE - WHEN mailbox = x'$after' OR hex(mailbox) LIKE '${after}00%' - THEN '$before' || SUBSTR(hex(mailbox), $((${#after}+1))) - WHEN hex(mailbox) LIKE '${after2}00%' - THEN '$before2' || SUBSTR(hex(mailbox), $((${#after2}+1))) - ELSE hex(mailbox) - END - FROM mailboxes - ORDER BY idx -EOF -diff -u --label="a/mailboxes.csv" --label="b/mailboxes.csv" \ - "$TMPDIR/mailboxes2.csv" "$TMPDIR/mailboxes3.csv" - -# vim: set filetype=sh : |