aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pullimap/t
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pullimap/t')
-rw-r--r--tests/pullimap/t42
1 files changed, 22 insertions, 20 deletions
diff --git a/tests/pullimap/t b/tests/pullimap/t
index 7998cdc..58a19ca 100644
--- a/tests/pullimap/t
+++ b/tests/pullimap/t
@@ -111,29 +111,31 @@ doveadm -u "remote" search mailbox "$MAILBOX" unseen >"$TMPDIR/unseen"
step_done
-step_start "--idle (${TIMEOUT}s)"
-
-pullimap --idle "remote" & PID=$!
-trap "ptree_abort $PID" EXIT INT TERM
-
-timer=$(( $(date +%s) + TIMEOUT ))
-while [ $(date +%s) -le $timer ]; do
- n="$(shuf -n1 -i1-5)"
- for (( i=0; i < n; i++)); do
- sample_message | deliver -u "remote" -- -m "$MAILBOX"
+if [ $TIMEOUT -gt 0 ]; then
+ step_start "--idle (${TIMEOUT}s)"
+
+ pullimap --idle "remote" & PID=$!
+ trap "ptree_abort $PID" EXIT INT TERM
+
+ timer=$(( $(date +%s) + TIMEOUT ))
+ while [ $(date +%s) -le $timer ]; do
+ n="$(shuf -n1 -i1-5)"
+ for (( i=0; i < n; i++)); do
+ sample_message | deliver -u "remote" -- -m "$MAILBOX"
+ done
+
+ s=$(shuf -n1 -i1-1500)
+ [ $s -ge 1000 ] && s="$(printf "1.%03d" $((s-1000)))" || s="$(printf "0.%03d" $s)"
+ sleep "$s"
done
- s=$(shuf -n1 -i1-1500)
- [ $s -ge 1000 ] && s="$(printf "1.%03d" $((s-1000)))" || s="$(printf "0.%03d" $s)"
- sleep "$s"
-done
-
-sleep 5
-ptree_abort $PID
-trap - EXIT INT TERM
+ sleep 5
+ ptree_abort $PID
+ trap - EXIT INT TERM
-check
-step_done
+ check
+ step_done
+fi
step_start "Purging"