Skip to content

Commit

Permalink
Fix flaky PhysicalFileProviderTests (dotnet#72553)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmoseley committed Jul 21, 2022
1 parent dcf2c76 commit b5904da
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ public async Task TokensFiredOnFileChange()

[Fact]
[SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.tvOS, "System.IO.FileSystem.Watcher is not supported on Browser/iOS/tvOS")]
[SkipOnCoreClr("JitStress slows this down too much", RuntimeTestModes.JitStress | RuntimeTestModes.JitStressRegs)]
public async Task TokenCallbackInvokedOnFileChange()
{
using (var root = new TempDirectory(GetTestFilePath()))
Expand All @@ -402,7 +403,7 @@ public async Task TokenCallbackInvokedOnFileChange()
}, state: null);

fileSystemWatcher.CallOnChanged(new FileSystemEventArgs(WatcherChangeTypes.Changed, root.Path, fileName));
await Task.Delay(WaitTimeForTokenToFire);
await Task.Delay(WaitTimeForTokenCallback);

Assert.True(callbackInvoked, "Callback should have been invoked");
}
Expand Down Expand Up @@ -803,7 +804,7 @@ public async Task FileChangeTokenNotNotifiedAfterExpiry()

// Callback expected.
fileSystemWatcher.CallOnChanged(new FileSystemEventArgs(WatcherChangeTypes.Changed, root.Path, fileName));
await Task.Delay(WaitTimeForTokenToFire);
await Task.Delay(WaitTimeForTokenCallback);

// Callback not expected.
fileSystemWatcher.CallOnChanged(new FileSystemEventArgs(WatcherChangeTypes.Changed, root.Path, fileName));
Expand Down Expand Up @@ -886,7 +887,7 @@ public async Task TokenNotAffectedByExceptions()
}, null);

fileSystemWatcher.CallOnChanged(new FileSystemEventArgs(WatcherChangeTypes.Changed, root.Path, fileName));
await Task.Delay(WaitTimeForTokenToFire);
await Task.Delay(WaitTimeForTokenCallback);

Assert.True(token.HasChanged);
}
Expand Down

0 comments on commit b5904da

Please sign in to comment.