Skip to content

Commit 9481422

Browse files
authored
Add retry to symlink test (#73042)
1 parent 0ba3d31 commit 9481422

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/PhysicalFileProviderTests.netcoreapp.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ public async Task UsePollingFileWatcher_UseActivePolling_HasChanged_SymbolicLink
107107

108108
// Act - Change link target to file 2.
109109
File.Delete(linkPath);
110-
File.CreateSymbolicLink(linkPath, file2Path);
110+
111+
RetryHelper.Execute(() =>
112+
{
113+
File.CreateSymbolicLink(linkPath, file2Path); // can fail, presumably due to some latency of delete of linkPath
114+
}, maxAttempts: 10, retryWhen: e => e is UnauthorizedAccessException);
111115

112116
// Assert - It should report the change regardless of the timestamp being older.
113117
Assert.True(await tcs.Task,

0 commit comments

Comments
 (0)