aboutsummaryrefslogtreecommitdiffstats
path: root/tests/05-repair
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-11-09 03:13:45 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-11-13 06:23:56 +0100
commit67440844c422ee30b31df9a46a7f99ac0e833add (patch)
tree989381e5b94d5939dafdd1e99c7db2ada95355ec /tests/05-repair
parentb9da6cc7ecf71026d1023dc3354b820c7518426e (diff)
Refactor and improve test suite.
Diffstat (limited to 'tests/05-repair')
-rw-r--r--tests/05-repair/local.conf6
-rw-r--r--tests/05-repair/remote.conf6
-rw-r--r--tests/05-repair/run107
3 files changed, 0 insertions, 119 deletions
diff --git a/tests/05-repair/local.conf b/tests/05-repair/local.conf
deleted file mode 100644
index 93497d9..0000000
--- a/tests/05-repair/local.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace inbox {
- separator = .
- location = maildir:~/inbox:LAYOUT=index
- inbox = yes
- list = yes
-}
diff --git a/tests/05-repair/remote.conf b/tests/05-repair/remote.conf
deleted file mode 100644
index 352cdd4..0000000
--- a/tests/05-repair/remote.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace inbox {
- separator = ~
- location = maildir:~/inbox:LAYOUT=index
- inbox = yes
- list = yes
-}
diff --git a/tests/05-repair/run b/tests/05-repair/run
deleted file mode 100644
index 66f9ce9..0000000
--- a/tests/05-repair/run
+++ /dev/null
@@ -1,107 +0,0 @@
-# create some mailboxes and populate them
-doveadm -u "local" mailbox create "foo.bar"
-doveadm -u "remote" mailbox create "foo~bar" "baz"
-for ((i = 0; i < 8; i++)); do
- sample_message | deliver -u "local" -- -m "foo.bar"
- sample_message | deliver -u "remote" -- -m "foo~bar"
-done
-for ((i = 0; i < 64; i++)); do
- sample_message | deliver -u "remote" -- -m "baz"
-done
-
-interimap
-check_mailbox_list
-check_mailboxes_status "foo.bar" "baz" "INBOX"
-
-# make more changes (flag updates, new massages, deletions)
-sample_message | deliver -u "remote" -- -m "INBOX"
-doveadm -u "local" expunge mailbox "baz" 1:10
-doveadm -u "remote" expunge mailbox "baz" "$(seq -s"," 1 2 32),$(seq -s"," 40 2 64)"
-doveadm -u "local" expunge mailbox "foo.bar" 2,3,5:7,10
-doveadm -u "remote" expunge mailbox "foo~bar" 4,5,7,10
-doveadm -u "local" flags add "\\Answered" mailbox "foo.bar" 2,3,5:7,10
-doveadm -u "remote" flags add "\\Seen" mailbox "foo~bar" 4,5,7
-
-# spoof HIGHESTMODSEQ value in the database, to make it look that we recorded the new changes already
-spoof() {
- local k="$1" v m hex="$(printf "%s\\0%s" "foo" "bar" | xxd -ps)"
- shift
- while [ $# -gt 0 ]; do
- [ "$1" = "local" ] && m="foo.bar" || m="$(printf "%s" "foo.bar" | tr "." "~")"
- v="$(doveadm -u "$1" -f flow mailbox status "${k,,[A-Z]}" "$m" | sed 's/.*=//')"
- sqlite3 "$XDG_DATA_HOME/interimap/remote.db" <<-EOF
- UPDATE \`$1\` SET $k = $v
- WHERE idx = (SELECT idx FROM mailboxes WHERE mailbox = x'$hex');
- EOF
- shift
- done
-}
-
-spoof HIGHESTMODSEQ "local" "remote"
-sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/dump.sql" <<-EOF
- .dump
-EOF
-doveadm -u "local" mailbox status "all" "foo.bar" >"$TMPDIR/foo-bar.status.local"
-doveadm -u "remote" mailbox status "all" "foo~bar" >"$TMPDIR/foo-bar.status.remote"
-
-
-# verify that without --repair interimap does nothing due to the spoofed HIGHESTMODSEQ values
-interimap "foo.bar"
-
-sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/dump2.sql" <<-EOF
- .dump
-EOF
-doveadm -u "local" mailbox status all "foo.bar" >"$TMPDIR/foo-bar.status2.local"
-doveadm -u "remote" mailbox status all "foo~bar" >"$TMPDIR/foo-bar.status2.remote"
-diff -u --label="a/dump.sql" --label="b/dump.sql" "$TMPDIR/dump.sql" "$TMPDIR/dump2.sql"
-diff -u --label="a/foo_bar.local" --label="a/foo_bar.local" "$TMPDIR/foo-bar.status.local" "$TMPDIR/foo-bar.status2.local"
-diff -u --label="a/foo_bar.remote" --label="a/foo_bar.remote" "$TMPDIR/foo-bar.status.remote" "$TMPDIR/foo-bar.status2.remote"
-
-
-# deliver more messages and spoof UIDNEXT, on one side only
-sample_message | deliver -u "local" -- -m "foo.bar"
-sample_message | deliver -u "remote" -- -m "foo~bar"
-spoof UIDNEXT "local"
-spoof HIGHESTMODSEQ "local" "remote"
-
-# now repair
-interimap --repair "baz" "foo.bar"
-
-# 6 updates with \Answered (luid 4,8,11:13,16), 2 of which (luid 12,13) vanished from remote
-# 3 updates with \Seen (ruid 6,8,10), 1 of which (uid 10) vanished from remote
-# luid 16 <-> ruid 8 has both \Answered and \Seen
-xcgrep 5 '^WARNING: Missed flag update in foo\.bar for ' <"$STDERR"
-xcgrep 5 '^WARNING: Conflicting flag update in foo\.bar ' <"$STDERR"
-
-# luid 2 <-> ruid 10
-xcgrep 1 -E '^WARNING: Pair \(lUID,rUID\) = \([0-9]+,[0-9]+\) vanished from foo\.bar\. Repairing\.$' <"$STDERR"
-
-# 6-1 (luid 2 <-> ruid 10 is gone from both)
-xcgrep 5 -E '^local\(foo\.bar\): WARNING: UID [0-9]+ disappeared. Redownloading remote UID [0-9]+\.$' <"$STDERR"
-
-# 6-1 (luid 2 <-> ruid 10 is gone from both)
-xcgrep 3 -E '^remote\(foo~bar\): WARNING: UID [0-9]+ disappeared. Redownloading local UID [0-9]+\.$' <"$STDERR"
-
-xgrep -E '^local\(baz\): Removed 24 UID\(s\) ' <"$STDERR"
-xgrep -E '^remote\(baz\): Removed 5 UID\(s\) ' <"$STDERR"
-
-# pining UIDs here is not very robust...
-xgrep -E '^local\(foo\.bar\): Updated flags \(\\Answered \\Seen\) for UID 16$' <"$STDERR"
-xgrep -E '^local\(foo\.bar\): Updated flags \(\\Seen\) for UID 14$' <"$STDERR"
-xgrep -E '^remote\(foo~bar\): Updated flags \(\\Answered \\Seen\) for UID 8$' <"$STDERR"
-xgrep -E '^remote\(foo~bar\): Updated flags \(\\Answered\) for UID 3,12,16$' <"$STDERR"
-
-# luid 17
-xcgrep 1 -E '^remote\(foo~bar\): WARNING: No match for modified local UID [0-9]+. Redownloading\.' <"$STDERR"
-
-xgrep -E '^local\(foo\.bar\): Added 5 UID\(s\) ' <"$STDERR"
-xgrep -E '^remote\(foo~bar\): Added 4 UID\(s\) ' <"$STDERR"
-xgrep -E '^local\(foo\.bar\): Added 1 UID\(s\) ' <"$STDERR" # the new message
-
-check_mailbox_list
-check_mailboxes_status "baz" "foo.bar"
-
-interimap
-check_mailboxes_status "baz" "foo.bar" "INBOX"
-
-# vim: set filetype=sh :