summaryrefslogtreecommitdiff
path: root/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs')
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs112
1 files changed, 112 insertions, 0 deletions
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
index 0c6e5873..b3ef9430 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/BundlePackageTests.cs
@@ -5,6 +5,7 @@ namespace WixToolsetTest.BurnE2E
5 using System; 5 using System;
6 using System.IO; 6 using System.IO;
7 using WixTestTools; 7 using WixTestTools;
8 using WixToolset.Mba.Core;
8 using Xunit; 9 using Xunit;
9 using Xunit.Abstractions; 10 using Xunit.Abstractions;
10 11
@@ -137,5 +138,116 @@ namespace WixToolsetTest.BurnE2E
137 upgradeBundlePackageBundlev1.VerifyUnregisteredAndRemovedFromPackageCache(); 138 upgradeBundlePackageBundlev1.VerifyUnregisteredAndRemovedFromPackageCache();
138 bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache(); 139 bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache();
139 } 140 }
141
142 [RuntimeFact]
143 public void CanRecacheAndReinstallBundlePackageOnUninstallRollback()
144 {
145 var packageFail = this.CreatePackageInstaller("PackageFail");
146 var packageA = this.CreatePackageInstaller(@"..\BasicFunctionalityTests\PackageA");
147 var bundleA = this.CreateBundleInstaller(@"..\BasicFunctionalityTests\BundleA");
148 var bundlePackageUninstallFailureBundle = this.CreateBundleInstaller("BundlePackageUninstallFailureBundle");
149 var testBAController = this.CreateTestBAController();
150 var bundleASelfCachedPath = bundleA.GetExpectedCachedBundlePath();
151 var bundleAEmbeddedCachedPath = bundlePackageUninstallFailureBundle.GetPackageEntryPointCachePath("PackageA");
152
153 packageA.VerifyInstalled(false);
154 packageFail.VerifyInstalled(false);
155 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
156
157 testBAController.SetPackageRequestedCacheType("PackageA", BOOTSTRAPPER_CACHE_TYPE.Remove);
158
159 var installLogPath = bundlePackageUninstallFailureBundle.Install();
160 bundlePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache();
161 packageFail.VerifyInstalled(true);
162 bundleA.VerifyRegisteredAndInPackageCache(expectedSystemComponent: 1);
163
164 Assert.False(LogVerifier.MessageInLogFile(installLogPath, $"Applying execute package: PackageA, action: Install, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
165 Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"Applying execute package: PackageA, action: Install, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
166
167 testBAController.ResetPackageStates("PackageA");
168 testBAController.SetAllowAcquireAfterValidationFailure();
169
170 var uninstallLogPath = bundlePackageUninstallFailureBundle.Uninstall((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, "FAILWHENDEFERRED=1");
171 bundlePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache();
172 bundleA.VerifyRegisteredAndInPackageCache(expectedSystemComponent: 1);
173 packageFail.VerifyInstalled(true);
174
175 Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, "TESTBA: OnCachePackageNonVitalValidationFailure() - id: PackageA, default: None, requested: Acquire"));
176 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying execute package: PackageA, action: Uninstall, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
177 Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying execute package: PackageA, action: Uninstall, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
178 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying rollback package: PackageA, action: Install, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
179 Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying rollback package: PackageA, action: Install, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
180 }
181
182 [RuntimeFact]
183 public void CanReinstallBundlePackageOnUninstallRollback()
184 {
185 var packageFail = this.CreatePackageInstaller("PackageFail");
186 var packageA = this.CreatePackageInstaller(@"..\BasicFunctionalityTests\PackageA");
187 var bundleA = this.CreateBundleInstaller(@"..\BasicFunctionalityTests\BundleA");
188 var bundlePackageUninstallFailureBundle = this.CreateBundleInstaller("BundlePackageUninstallFailureBundle");
189 var bundleASelfCachedPath = bundleA.GetExpectedCachedBundlePath();
190 var bundleAEmbeddedCachedPath = bundlePackageUninstallFailureBundle.GetPackageEntryPointCachePath("PackageA");
191
192 packageA.VerifyInstalled(false);
193 packageFail.VerifyInstalled(false);
194 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
195
196 var installLogPath = bundlePackageUninstallFailureBundle.Install();
197 bundlePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache();
198 packageFail.VerifyInstalled(true);
199 bundleA.VerifyRegisteredAndInPackageCache(expectedSystemComponent: 1);
200
201 Assert.False(LogVerifier.MessageInLogFile(installLogPath, $"Applying execute package: PackageA, action: Install, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
202 Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"Applying execute package: PackageA, action: Install, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
203
204 var uninstallLogPath = bundlePackageUninstallFailureBundle.Uninstall((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, "FAILWHENDEFERRED=1");
205 bundlePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache();
206 bundleA.VerifyRegisteredAndInPackageCache(expectedSystemComponent: 1);
207 packageFail.VerifyInstalled(true);
208
209 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, "TESTBA: OnCachePackageNonVitalValidationFailure() - id: PackageA"));
210 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying execute package: PackageA, action: Uninstall, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
211 Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying execute package: PackageA, action: Uninstall, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
212 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying rollback package: PackageA, action: Install, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
213 Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying rollback package: PackageA, action: Install, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
214 }
215
216 [RuntimeFact]
217 public void CanSkipReinstallBundlePackageOnUninstallRollback()
218 {
219 var packageFail = this.CreatePackageInstaller("PackageFail");
220 var packageA = this.CreatePackageInstaller(@"..\BasicFunctionalityTests\PackageA");
221 var bundleA = this.CreateBundleInstaller(@"..\BasicFunctionalityTests\BundleA");
222 var bundlePackageUninstallFailureBundle = this.CreateBundleInstaller("BundlePackageUninstallFailureBundle");
223 var testBAController = this.CreateTestBAController();
224 var bundleASelfCachedPath = bundleA.GetExpectedCachedBundlePath();
225 var bundleAEmbeddedCachedPath = bundlePackageUninstallFailureBundle.GetPackageEntryPointCachePath("PackageA");
226
227 packageA.VerifyInstalled(false);
228 packageFail.VerifyInstalled(false);
229 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
230
231 testBAController.SetPackageRequestedCacheType("PackageA", BOOTSTRAPPER_CACHE_TYPE.Remove);
232
233 var installLogPath = bundlePackageUninstallFailureBundle.Install();
234 bundlePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache();
235 packageFail.VerifyInstalled(true);
236 bundleA.VerifyRegisteredAndInPackageCache(expectedSystemComponent: 1);
237
238 Assert.False(LogVerifier.MessageInLogFile(installLogPath, $"Applying execute package: PackageA, action: Install, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
239 Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"Applying execute package: PackageA, action: Install, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
240
241 var uninstallLogPath = bundlePackageUninstallFailureBundle.Uninstall((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE, "FAILWHENDEFERRED=1");
242 bundlePackageUninstallFailureBundle.VerifyRegisteredAndInPackageCache();
243 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
244 packageFail.VerifyInstalled(true);
245
246 Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, "TESTBA: OnCachePackageNonVitalValidationFailure() - id: PackageA, default: None, requested: None"));
247 Assert.True(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying execute package: PackageA, action: Uninstall, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
248 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying execute package: PackageA, action: Uninstall, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
249 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying rollback package: PackageA, action: Install, path: {bundleASelfCachedPath}"), bundleASelfCachedPath);
250 Assert.False(LogVerifier.MessageInLogFile(uninstallLogPath, $"Applying rollback package: PackageA, action: Install, path: {bundleAEmbeddedCachedPath}"), bundleAEmbeddedCachedPath);
251 }
140 } 252 }
141} 253}