aboutsummaryrefslogtreecommitdiffstats
path: root/tests/delimiter-change/t
blob: 3f969534a7840df37ee5f4772ba8a623fe7fed12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 :