Fix subtle timing issue in command/expire tests.

cdebfb09 added relative times to backup.into but a subtle issue was introduced that would cause the tests to fail if the time acquired by cmdExpire() was exactly the same as timeNow used to format backup.info. cmdExpire() was working correctly given the inputs, but the tests did not run predictably.

This was found while running the tests with --no-valgrind --no-coverage which allows them to run a lot faster, thus exposing the timing issue.
This commit is contained in:
David Steele
2020-05-09 12:12:29 -04:00
parent 22d260ad53
commit 86855e271d
+4
View File
@@ -155,6 +155,10 @@ testRun(void)
const Buffer *backupInfoBase = harnessInfoChecksumZ(strPtr(backupInfoContent));
// Sleep the remainder of the current second. If cmdExpire() gets the same time as timeNow then expiration won't work as
// expected in the tests.
sleepMSec(MSEC_PER_SEC - (timeMSec() % MSEC_PER_SEC));
// *****************************************************************************************************************************
if (testBegin("expireBackup()"))
{