Skip to content

Commit c98cff6

Browse files
committed
test fix
1 parent 2ec05ad commit c98cff6

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

test/Azure.Functions.Cli.Tests/ZipHelperTests.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public class ZipHelperTests
1919
public ZipHelperTests(ITestOutputHelper output)
2020
{
2121
_output = output;
22+
23+
// reset to default in case other tests have set this up with mocks
24+
FileSystemHelpers.Instance = null;
2225
}
2326

2427
[Fact]
@@ -31,7 +34,7 @@ public async Task CreateZip_Succeeds()
3134
{
3235
if (_isCI)
3336
{
34-
// copy the linux zip so we can include it in the docker image for validation
37+
// copy the windows-built linux zip so we can include it in ci artifacts for validation on linux
3538
File.Copy(linuxZip, Path.Combine(Directory.GetCurrentDirectory(), "ZippedOnWindows.zip"), true);
3639
}
3740

@@ -92,7 +95,7 @@ private async Task<string> BuildAndCopyFileToZipAsync(string rid)
9295
foreach (string fileName in new[] { exe, dll, config })
9396
{
9497
var f = new DirectoryInfo(outPath).GetFiles(fileName, SearchOption.AllDirectories).FirstOrDefault();
95-
Assert.True(exe != null, $"{fileName} not found.");
98+
Assert.True(f != null, $"{fileName} not found.");
9699
string destFile = Path.Combine(tempDir, fileName);
97100
File.Copy(f.FullName, destFile);
98101
files.Add(destFile);
@@ -102,15 +105,6 @@ private async Task<string> BuildAndCopyFileToZipAsync(string rid)
102105
var zipFile = Path.Combine(tempDir, "test.zip");
103106
var stream = await ZipHelper.CreateZip(files, tempDir, executables: new string[] { exe });
104107

105-
if (stream == null)
106-
{
107-
_output.WriteLine($"zipFile: {zipFile}");
108-
_output.WriteLine($"file exists: {File.Exists(zipFile)}");
109-
_output.WriteLine($"dir exists: {Directory.Exists(tempDir)}");
110-
}
111-
112-
Assert.NotNull(stream);
113-
114108
await FileSystemHelpers.WriteToFile(zipFile, stream);
115109

116110
return zipFile;

0 commit comments

Comments
 (0)