Skip to content

Commit cb5e760

Browse files
authored
Add diagnostics to symlink embedding unittest (#8653)
Adding diagnostics to flaky test - to have more data on future repro (logging the actual list of embedded files)
1 parent 6487653 commit cb5e760

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/Build.UnitTests/BinaryLogger_Tests.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ public void BinaryLoggerShouldEmbedFilesViaTaskOutput()
262262

263263
// Can't just compare `Name` because `ZipArchive` does not handle unix directory separators well
264264
// thus producing garbled fully qualified paths in the actual .ProjectImports.zip entries
265-
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"));
265+
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"),
266+
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
266267
}
267268

268269
[RequiresSymbolicLinksFact]
@@ -321,10 +322,14 @@ public void BinaryLoggerShouldEmbedSymlinkFilesViaTaskOutput()
321322

322323
// Can't just compare `Name` because `ZipArchive` does not handle unix directory separators well
323324
// thus producing garbled fully qualified paths in the actual .ProjectImports.zip entries
324-
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"));
325-
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkName));
326-
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkLvl2Name));
327-
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(emptyFileName));
325+
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"),
326+
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
327+
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkName),
328+
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
329+
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkLvl2Name),
330+
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
331+
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(emptyFileName),
332+
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
328333
}
329334

330335
[Fact]

src/UnitTests.Shared/RequiresSymbolicLinksFactAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public RequiresSymbolicLinksFactAttribute()
2727
// In Windows, a process can create symlinks only if it has sufficient permissions.
2828
// We simply try to create one and if it fails we skip the test.
2929
string sourceFile = FileUtilities.GetTemporaryFile();
30-
string destinationFile = FileUtilities.GetTemporaryFile();
30+
string destinationFile = FileUtilities.GetTemporaryFileName();
3131
try
3232
{
3333
File.Create(sourceFile).Dispose();

0 commit comments

Comments
 (0)