From 67440844c422ee30b31df9a46a7f99ac0e833add Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 9 Nov 2019 03:13:45 +0100 Subject: Refactor and improve test suite. --- tests/07-sync-live/local.conf | 6 ---- tests/07-sync-live/remote.conf | 6 ---- tests/07-sync-live/run | 80 ------------------------------------------ 3 files changed, 92 deletions(-) delete mode 100644 tests/07-sync-live/local.conf delete mode 100644 tests/07-sync-live/remote.conf delete mode 100644 tests/07-sync-live/run (limited to 'tests/07-sync-live') diff --git a/tests/07-sync-live/local.conf b/tests/07-sync-live/local.conf deleted file mode 100644 index 1333540..0000000 --- a/tests/07-sync-live/local.conf +++ /dev/null @@ -1,6 +0,0 @@ -namespace inbox { - separator = . - location = dbox:~/inbox:LAYOUT=index - inbox = yes - list = yes -} diff --git a/tests/07-sync-live/remote.conf b/tests/07-sync-live/remote.conf deleted file mode 100644 index 3267182..0000000 --- a/tests/07-sync-live/remote.conf +++ /dev/null @@ -1,6 +0,0 @@ -namespace inbox { - separator = ^ - location = dbox:~/inbox:LAYOUT=index - inbox = yes - list = yes -} diff --git a/tests/07-sync-live/run b/tests/07-sync-live/run deleted file mode 100644 index 04d8247..0000000 --- a/tests/07-sync-live/run +++ /dev/null @@ -1,80 +0,0 @@ -# create database -interimap - -# start a long-lived interimap process -interimap --watch=1 & pid=$! - -abort() { - # kill interimap process and its children - pkill -P "$pid" -TERM || true - kill -TERM "$pid" || true - wait -} -trap abort EXIT INT TERM - -# mailbox list and alphabet (exclude &, / and ~, which dovecot treats specially) -declare -a mailboxes=( "INBOX" ) alphabet=() -str="!\"#\$'()+,-0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]_\`abcdefghijklmnopqrstuvwxyz{|}" -for ((i=0; i < ${#str}; i++)); do - alphabet[i]="${str:i:1}" -done - -timer=$(( $(date +%s) + 30 )) -while [ $(date +%s) -le $timer ]; do - # create new mailbox with 10% probability - if [ $(shuf -n1 -i0-9) -eq 0 ]; then - m= - d=$(shuf -n1 -i1-3) # random depth - for (( i=0; i < d; i++)); do - l=$(shuf -n1 -i1-16) - m="${m:+$m.}$(shuf -n "$l" -e -- "${alphabet[@]}" | tr -d '\n')" - done - mailboxes+=( "$m" ) - u="$(shuf -n1 -e "local" "remote")" # choose target at random - [ "$u" = "local" ] || m="${m//./^}" - doveadm -u "$u" mailbox create -- "$m" - fi - - # EXPUNGE some messages - u="$(shuf -n1 -e "local" "remote")" # choose target at random - n="$(shuf -n1 -i0-3)" - while read guid uid; do - doveadm -u "$u" expunge mailbox-guid "$guid" uid "$uid" - done < <(doveadm -u "$u" search all | shuf -n "$n") - - # mark some existing messages as read (toggle \Seen flag as unlike other - # flags it's easier to query and check_mailboxes_status checks it) - u="$(shuf -n1 -e "local" "remote")" # choose target at random - n="$(shuf -n1 -i0-9)" - while read guid uid; do - a="$(shuf -n1 -e add remove replace)" - doveadm -u "$u" flags "$a" "\\Seen" mailbox-guid "$guid" uid "$uid" - done < <(doveadm -u "$u" search all | shuf -n "$n") - - # select at random a mailbox where to deliver some messages - u="$(shuf -n1 -e "local" "remote")" # choose target at random - m="$(shuf -n1 -e -- "${mailboxes[@]}")" - [ "$u" = "local" ] || m="${m//./^}" - - # deliver between 1 and 5 messages to the chosen mailbox - n="$(shuf -n1 -i1-5)" - for (( i=0; i < n; i++)); do - sample_message | deliver -u "$u" -- -m "$m" - done - - # sleep a little bit - sleep "$(printf "0.%03d" "$(shuf -n1 -i1-999)")" -done - -# wait a little longer so interimap has time to run loop() again and -# synchronize outstanding changes, then terminate the process we started -# above -sleep 2 - -abort -trap - EXIT INT TERM - -check_mailbox_list -check_mailboxes_status "${mailboxes[@]}" - -# vim: set filetype=sh : -- cgit v1.2.3