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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user