From 2e149b74c29c36561a7dd8ebc2aedb9e62a678bc Mon Sep 17 00:00:00 2001 From: youtous Date: Fri, 24 Apr 2020 17:03:09 +0200 Subject: [PATCH] fix async quota tests --- test/tests.bats | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/test/tests.bats b/test/tests.bats index 03600159..3b310783 100644 --- a/test/tests.bats +++ b/test/tests.bats @@ -1094,11 +1094,8 @@ EOF [ "${originalChangesProcessed}" != "$(count_processed_changes mail)" ] assert_success - # let dovecot breathe - sleep 5 - - run docker exec mail /bin/sh -c 'doveadm quota get -u user1@localhost.localdomain | grep "User quota STORAGE"' - assert_output --partial '51200' + # wait until quota has been updated + run repeat_until_success_or_timeout 20 sh -c "docker exec mail sh -c 'doveadm quota get -u user1@localhost.localdomain | grep -oP \"(User quota STORAGE\s+[0-9]+\s+)51200(.*)\"'" assert_success # remove the quota @@ -1116,11 +1113,8 @@ EOF [ "${originalChangesProcessed}" != "$(count_processed_changes mail)" ] assert_success - # let dovecot breathe - sleep 5 - - run docker exec mail /bin/sh -c 'doveadm quota get -u user1@localhost.localdomain | grep "User quota STORAGE"' - assert_output --partial '- 0' + # wait until quota has been updated + run repeat_until_success_or_timeout 20 sh -c "docker exec mail sh -c 'doveadm quota get -u user1@localhost.localdomain | grep -oP \"(User quota STORAGE\s+[0-9]+\s+)-(.*)\"'" assert_success } @@ -1142,11 +1136,8 @@ EOF [ "${originalChangesProcessed}" != "$(count_processed_changes mail)" ] assert_success - # let dovecot breathe - sleep 5 - - run docker exec mail /bin/sh -c 'doveadm quota get -u quotauser@otherdomain.tld | grep "User quota STORAGE"' - assert_output --partial '10' + # wait until quota has been updated + run repeat_until_success_or_timeout 20 sh -c "docker exec mail sh -c 'doveadm quota get -u quotauser@otherdomain.tld | grep -oP \"(User quota STORAGE\s+[0-9]+\s+)10(.*)\"'" assert_success # send some big emails