diff options
Diffstat (limited to 'src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs')
-rw-r--r-- | src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs new file mode 100644 index 00000000..a11a5eb6 --- /dev/null +++ b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs | |||
@@ -0,0 +1,112 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.BurnE2E | ||
4 | { | ||
5 | using WixTestTools; | ||
6 | using Xunit; | ||
7 | using Xunit.Abstractions; | ||
8 | |||
9 | public class FailureTests : BurnE2ETests | ||
10 | { | ||
11 | public FailureTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | ||
12 | |||
13 | [Fact] | ||
14 | public void CanCancelMsiPackageVeryEarly() | ||
15 | { | ||
16 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
17 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
18 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
19 | var testBAController = this.CreateTestBAController(); | ||
20 | |||
21 | // Cancel package B right away. | ||
22 | testBAController.SetPackageCancelExecuteAtProgress("PackageB", 1); | ||
23 | |||
24 | bundleA.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT); | ||
25 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
26 | |||
27 | packageA.VerifyInstalled(false); | ||
28 | packageB.VerifyInstalled(false); | ||
29 | } | ||
30 | |||
31 | [Fact] | ||
32 | public void CanCancelMsiPackageVeryLate() | ||
33 | { | ||
34 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
35 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
36 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
37 | var testBAController = this.CreateTestBAController(); | ||
38 | |||
39 | // Cancel package B at the last moment possible. | ||
40 | testBAController.SetPackageCancelExecuteAtProgress("PackageB", 100); | ||
41 | |||
42 | bundleA.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT); | ||
43 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
44 | |||
45 | packageA.VerifyInstalled(false); | ||
46 | packageB.VerifyInstalled(false); | ||
47 | } | ||
48 | |||
49 | [Fact] | ||
50 | public void CanCancelMsiPackageInOnProgress() | ||
51 | { | ||
52 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
53 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
54 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
55 | var testBAController = this.CreateTestBAController(); | ||
56 | |||
57 | // Cancel package B during its OnProgress message. | ||
58 | testBAController.SetPackageCancelOnProgressAtProgress("PackageB", 100); | ||
59 | |||
60 | bundleA.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT); | ||
61 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
62 | |||
63 | packageA.VerifyInstalled(false); | ||
64 | packageB.VerifyInstalled(false); | ||
65 | } | ||
66 | |||
67 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/5750")] | ||
68 | public void CanCancelExecuteWhileCaching() | ||
69 | { | ||
70 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
71 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
72 | var bundleB = this.CreateBundleInstaller("BundleB"); | ||
73 | var testBAController = this.CreateTestBAController(); | ||
74 | |||
75 | // Slow the caching of package B to ensure that package A starts installing and cancels. | ||
76 | testBAController.SetPackageCancelExecuteAtProgress("PackageA", 50); | ||
77 | testBAController.SetPackageSlowCache("PackageB", 2000); | ||
78 | |||
79 | bundleB.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT); | ||
80 | bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
81 | |||
82 | packageA.VerifyInstalled(false); | ||
83 | packageB.VerifyInstalled(false); | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// BundleC has non-vital PackageA and vital PackageB. | ||
88 | /// PackageA is not compressed in the bundle and has a Name different from the source file. The Name points to a file that does not exist. | ||
89 | /// BundleC should be able to install successfully by ignoring the missing PackageA and installing PackageB. | ||
90 | /// </summary> | ||
91 | [Fact] | ||
92 | public void CanInstallWhenMissingNonVitalPackage() | ||
93 | { | ||
94 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
95 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
96 | var bundleC = this.CreateBundleInstaller("BundleC"); | ||
97 | |||
98 | var bundleCInstallLogFilePath = bundleC.Install(); | ||
99 | bundleC.VerifyRegisteredAndInPackageCache(); | ||
100 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleCInstallLogFilePath, "Skipping apply of package: PackageA due to cache error: 0x80070002. Continuing...")); | ||
101 | |||
102 | packageA.VerifyInstalled(false); | ||
103 | packageB.VerifyInstalled(true); | ||
104 | |||
105 | bundleC.Uninstall(); | ||
106 | bundleC.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
107 | |||
108 | packageA.VerifyInstalled(false); | ||
109 | packageB.VerifyInstalled(false); | ||
110 | } | ||
111 | } | ||
112 | } | ||