diff options
author | warwickmm <warwickmm@users.noreply.github.com> | 2021-03-08 19:52:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-08 19:52:34 +0300 |
commit | 3f58409ff8130414022182dcc0be9fd7599dde02 (patch) | |
tree | 7680a5bf8f968717678e1ee3247ab7a89bf9c696 | |
parent | b9db1ab1492e2e3bcdb9a2487308013c0c7e2d8f (diff) | |
parent | 88a1ec59c32ab721adee5e0d4061ff1e3c930b5d (diff) |
Merge pull request #4465 from duplicati/feature/more-robust-purge-testing
Add delay to purge-broken-files unit test.
Since the repair introduces artificial filelists, there is sometimes a race in CI where the purge is faster than a second causing the time sequences to not line up during testing.
-rw-r--r-- | Duplicati/UnitTest/PurgeTesting.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Duplicati/UnitTest/PurgeTesting.cs b/Duplicati/UnitTest/PurgeTesting.cs index d35d3dc1e..97954e5a5 100644 --- a/Duplicati/UnitTest/PurgeTesting.cs +++ b/Duplicati/UnitTest/PurgeTesting.cs @@ -233,6 +233,7 @@ namespace Duplicati.UnitTest }
File.Delete(dblock_file);
+ var last_ts = DateTime.Now;
long[] affectedfiles;
@@ -285,6 +286,12 @@ namespace Duplicati.UnitTest Assert.AreEqual(3, modFilesets);
}
+
+ // Since we make the operations back-to-back, the purge timestamp can drift beyond the current time
+ var wait_target = last_ts.AddSeconds(10) - DateTime.Now;
+ if (wait_target.TotalMilliseconds > 0)
+ System.Threading.Thread.Sleep(wait_target);
+
// A subsequent backup should be successful.
using (Controller c = new Controller("file://" + this.TARGETFOLDER, testopts, null))
{
|