If there isn't enough disk space, skip the 5GB test
Rob Mensching committed
Dec 2, 2021 at 22:17 UTC
70db45771d19126cdc85bcdc08cbcf36e002e2b5
1 file changed
+19
-6
src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs
+19
-6
@@ -2,6 +2,7 @@
2
3
namespace WixToolsetTest.BurnE2E
4
{
5
+ using System;
6
using System.Collections.Generic;
7
using System.IO;
8
using WixBuildTools.TestSupport;
@@ -17,23 +18,35 @@ namespace WixToolsetTest.BurnE2E
18
[Fact]
19
public void CanCache5GBFile()
20
{
20
- var packageA = this.CreatePackageInstaller("PackageA");
21
- var bundleC = this.CreateBundleInstaller("BundleC");
22
-
23
- packageA.VerifyInstalled(false);
24
-
21
// Recreate the 5GB payload to avoid having to copy it to the VM to run the tests.
22
+ const long FiveGB = 5_368_709_120;
23
+ const long OneGB = 1_073_741_824;
24
var targetFilePath = Path.Combine(this.TestContext.TestDataFolder, "fivegb.file");
25
+
26
+ // If the drive has less than 5GB (for the test file) plus 1GB (for working space), then
27
+ // skip the test.
28
+ var drive = new DriveInfo(targetFilePath.Substring(0, 1));
29
+ if (drive.AvailableFreeSpace < FiveGB + OneGB)
30
+ {
31
+ Console.WriteLine("Skipping CanCache5GBFile() test because there is not enough disk space available to run the test.");
32
+ return;
33
+ }
34
+
35
if (!File.Exists(targetFilePath))
36
{
37
var testTool = new TestTool(Path.Combine(TestData.Get(), "win-x86", "TestExe.exe"))
38
{
31
- Arguments = "/lf \"" + targetFilePath + "|5368709120\"",
39
+ Arguments = "/lf \"" + targetFilePath + $"|{FiveGB}\"",
40
ExpectedExitCode = 0,
41
};
42
testTool.Run(true);
43
}
44
45
+ var packageA = this.CreatePackageInstaller("PackageA");
46
+ var bundleC = this.CreateBundleInstaller("BundleC");
47
+
48
+ packageA.VerifyInstalled(false);
49
+
50
bundleC.Install();
51
bundleC.VerifyRegisteredAndInPackageCache();
52