diff options
Diffstat (limited to 'tests/pullimap/t')
-rw-r--r-- | tests/pullimap/t | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/pullimap/t b/tests/pullimap/t index 58a19ca..1c57f8d 100644 --- a/tests/pullimap/t +++ b/tests/pullimap/t @@ -13,14 +13,25 @@ if ! st="$(stat -c"%#a" -- "$XDG_DATA_HOME/pullimap/remote")" || [ "$st" != "060 fi step_done +step_start "\`pullimap\` locks its statefile" +pullimap --idle "remote" & PID=$! +trap "ptree_abort $PID" EXIT INT TERM +# wait a short while so we have time to lock the database (ugly and racy...) +sleep .5 +! pullimap "remote" || error +grep -F "Can't lock $XDG_DATA_HOME/pullimap/remote: Resource temporarily unavailable at " <"$STDERR" || error +ptree_abort $PID +trap - EXIT INT TERM +step_done + # compare mailboxes (can't compare the RFC 3501 TEXT as the LMTPd inconditionally # adds a Return-Path: header -- and also Delivered-To: and Received: to by default) list_mails_sha256() { local u="$1" guid uid local fields="body date.sent imap.bodystructure imap.envelope" while read guid uid; do - doveadm -u "$u" -f "flow" fetch "$fields" mailbox-guid "$guid" uid "$uid" | sha256sum - done < <(doveadm -u "$u" search mailbox "$MAILBOX") | sort -f + doveadm -u "$u" -f "flow" fetch --no-userdb-lookup "$fields" mailbox-guid "$guid" uid "$uid" | sha256sum + done < <(doveadm -u "$u" search mailbox --no-userdb-lookup "$MAILBOX") | sort -f } check() { diff -u --label="local/mails" --label="remote/mails" \ @@ -80,7 +91,7 @@ step_done # make sure remote UIDs are 11-bytes long -doveadm -u "remote" mailbox update --min-next-uid 1000000000 "$MAILBOX" +doveadm -u "remote" mailbox update --no-userdb-lookup --min-next-uid 1000000000 "$MAILBOX" # Add some messages and sync step_start "Fetching messages" @@ -98,7 +109,7 @@ for ((i = 0; i < N; i+=2)); do done for ((i = 0; i < N; i+=2)); do # expunge every other message - doveadm -u "remote" expunge mailbox "$MAILBOX" $((N-i+32+7)) + doveadm -u "remote" expunge --no-userdb-lookup mailbox "$MAILBOX" $((N-i+32+7)) sample_message | deliver -u "remote" -- -m "$MAILBOX" done @@ -106,7 +117,7 @@ pullimap "remote" || error check # count unseen remote messages -doveadm -u "remote" search mailbox "$MAILBOX" unseen >"$TMPDIR/unseen" +doveadm -u "remote" search --no-userdb-lookup mailbox "$MAILBOX" unseen >"$TMPDIR/unseen" [ ! -s "$TMPDIR/unseen" ] || error "\\Unseen messages left" step_done @@ -145,8 +156,8 @@ for ((i = 0; i < 32; i++)); do done pullimap "remote" -doveadm -u "remote" search mailbox "$MAILBOX" all >"$TMPDIR/messages" +doveadm -u "remote" search --no-userdb-lookup mailbox "$MAILBOX" all >"$TMPDIR/messages" [ ! -s "$TMPDIR/messages" ] || error "messages left" step_done -# vim: set filetype=sh : +# vim: set filetype=bash : |