aboutsummaryrefslogtreecommitdiffstats
path: root/tests/split-set/t
blob: 5e8ea52a6a1599a6ecdd8782ac1c5991e1354e13 (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
38
39
40
41
42
43
N=2048

# XXX with COMPRESS=DEFLATE dovecot-imapd 2.3.4 hangs when the command
# line exceeds 'imap_max_line_length' (or 8192, whichever is smaller)
# bytes, instead of returning a tagged BAD response.
# https://dovecot.org/pipermail/dovecot/2019-November/117522.html

# set UIDNEXT to 10^9 so all uids are 10 chars long, otherwise we'd need
# to add many more messages to obtain large sets
doveadm -u "local"  mailbox update --min-next-uid 1000000000 "INBOX"
doveadm -u "remote" mailbox update --min-next-uid 1000000000 "INBOX"

for ((i = 0; i < N; i++)); do
    u="$(shuf -n1 -e "local" "remote")"
    sample_message | deliver -u "$u"
done

interimap_init
check_mailbox_status "INBOX"

# mark every other message as \Seen on the local server
for ((i = 0; i < N; i+=2)); do
    doveadm -u "local" flags add "\\Seen" mailbox "INBOX" $((N-i))
done

# send the changes to the remote; this results into an UID STORE set
# representation of size 11*N/2-1, which exceeds $imap_max_line_length
interimap
check_mailbox_status "INBOX"

# now expunge every other message on the remote server; this results
# into large UID STORE and UID EXPUNGE set representation
for ((i = 0; i < N; i+=2)); do
    doveadm -u "local" expunge mailbox "INBOX" $((N-i))
    # add some more messages
    u="$(shuf -n1 -e "local" "remote")"
    sample_message | deliver -u "$u"
done

interimap || error
check_mailbox_status "INBOX"

# vim: set filetype=sh :