From d6e9e082720eb7ef5d8d592b9501b7c8a09900eb Mon Sep 17 00:00:00 2001 From: Kenneth Hsu Date: Mon, 8 Feb 2021 11:48:05 -0800 Subject: [PATCH] Increase tolerance for last write time tests on macOS. There are occasionally times where the difference is greater than 500ms. 1) Failed : Duplicati.UnitTest.BorderTests.Run100k Restore, creation time mismatch for /Users/runner/duplicati_testdata/backup-data/c-m2 and /Users/runner/duplicati_testdata/restored/c-m2 Expected: 2021-02-08 18:39:04.9202665 +/- 00:00:00.5000000 But was: 2021-02-08 18:39:05.572262 at Duplicati.UnitTest.TestUtils.AssertFilesAreEqual (System.String expectedFile, System.String actualFile, System.Boolean verifymetadata, System.String contextMessage) [0x0016f] in /Users/runner/work/duplicati/duplicati/Duplicati/UnitTest/TestUtils.cs:256 --- Duplicati/UnitTest/TestUtils.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Duplicati/UnitTest/TestUtils.cs b/Duplicati/UnitTest/TestUtils.cs index a09a0e912..68fa80d1e 100644 --- a/Duplicati/UnitTest/TestUtils.cs +++ b/Duplicati/UnitTest/TestUtils.cs @@ -245,10 +245,10 @@ namespace Duplicati.UnitTest // Compare file metadata if (verifymetadata) { - // OSX seem to like to actually set the time to some value earlier than what you set by tens of milliseconds. + // macOS seem to like to actually set the time to some value different than what you set by hundreds of milliseconds. // Reading the time right after it is set gives the expected value but when read later it is slightly different. // Maybe a bug in .net? - int granularity = Platform.IsClientOSX ? 500 : 1; + int granularity = Platform.IsClientOSX ? 999 : 1; Assert.That( SystemIO.IO_OS.GetLastWriteTimeUtc(actualFile), Is.EqualTo(SystemIO.IO_OS.GetLastWriteTimeUtc(expectedFile)).Within(granularity).Milliseconds,