diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-08-24 20:31:46 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-08-24 20:31:46 +0000 |
commit | 1f1d8355ad73eb9c0ab9aaeb069a21aecee78d6f (patch) | |
tree | 18894ab96968faa022dbd156c66ac1fb0df2e2ba /test | |
parent | 6f05cd831394335c32c6eebc4f4da7454302bbc9 (diff) |
Fix timing issue with bbackupd test for recovery after error.
For some reason the timing changed and the test was no longer waiting for the
same length of time as bbackupd, causing it to fail.
Merged back changes from the test refactor branch to reduce diffs.
Diffstat (limited to 'test')
-rw-r--r-- | test/bbackupd/testbbackupd.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index 3927c74d..bd648957 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -2756,10 +2756,12 @@ int test_bbackupd() TEST_THAT(close(fd1) == 0); } - // bbackupd should pause for about 90 seconds from - // store_fixed_time, so check that it hasn't run after - // 85 seconds after store_fixed_time - wait_for_operation(85 - time(NULL) + store_fixed_time, + // bbackupd should pause for BACKUP_ERROR_RETRY_SECONDS (plus + // a random delay of up to mUpdateStoreInterval/64 or 0.05 + // extra seconds) from store_fixed_time, so check that it + // hasn't run just before this time + wait_for_operation(BACKUP_ERROR_RETRY_SECONDS + + (store_fixed_time - time(NULL)) - 1, "just before bbackupd recovers"); TEST_THAT(!TestFileExists("testfiles/" "notifyran.backup-start.wait-snapshot.1")); @@ -2767,8 +2769,8 @@ int test_bbackupd() // Should not have backed up, should still get errors TEST_COMPARE(Compare_Different); - // wait another 10 seconds, bbackup should have run - wait_for_operation(10, "bbackupd to recover"); + // wait another 2 seconds, bbackup should have run + wait_for_operation(2, "bbackupd to recover"); TEST_THAT(TestFileExists("testfiles/" "notifyran.backup-start.wait-snapshot.1")); @@ -2839,10 +2841,12 @@ int test_bbackupd() TEST_THAT(close(fd1) == 0); } - // bbackupd should pause for about 90 seconds from - // store_fixed_time, so check that it hasn't run after - // 85 seconds from store_fixed_time - wait_for_operation(85 - time(NULL) + store_fixed_time, + // bbackupd should pause for BACKUP_ERROR_RETRY_SECONDS (plus + // a random delay of up to mUpdateStoreInterval/64 or 0.05 + // extra seconds) from store_fixed_time, so check that it + // hasn't run just before this time + wait_for_operation(BACKUP_ERROR_RETRY_SECONDS + + (store_fixed_time - time(NULL)) - 1, "just before bbackupd recovers"); TEST_THAT(!TestFileExists("testfiles/" "notifyran.backup-start.wait-automatic.1")); @@ -2850,8 +2854,8 @@ int test_bbackupd() // Should not have backed up, should still get errors TEST_COMPARE(Compare_Different); - // wait another 10 seconds, bbackup should have run - wait_for_operation(10, "bbackupd to recover"); + // wait another 2 seconds, bbackup should have run + wait_for_operation(2, "bbackupd to recover"); TEST_THAT(TestFileExists("testfiles/" "notifyran.backup-start.wait-automatic.1")); |