aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn/WixToolsetTest.BurnE2E/SlipstreamTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/burn/WixToolsetTest.BurnE2E/SlipstreamTests.cs')
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/SlipstreamTests.cs353
1 files changed, 353 insertions, 0 deletions
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/SlipstreamTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/SlipstreamTests.cs
new file mode 100644
index 00000000..29632e2e
--- /dev/null
+++ b/src/test/burn/WixToolsetTest.BurnE2E/SlipstreamTests.cs
@@ -0,0 +1,353 @@
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
3namespace WixToolsetTest.BurnE2E
4{
5 using System;
6 using System.IO;
7 using WixTestTools;
8 using WixToolset.Mba.Core;
9 using Xunit;
10 using Xunit.Abstractions;
11
12 public class SlipstreamTests : BurnE2ETests
13 {
14 public SlipstreamTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
15
16 private const string V090 = "0.9.0.0";
17 private const string V100 = "1.0.0.0";
18 private const string V101 = "1.0.1.0";
19
20 [Fact]
21 public void CanInstallBundleWithSlipstreamedPatchThenRemoveIt()
22 {
23 var testRegistryValue = "PackageA";
24
25 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
26 var bundleA = this.CreateBundleInstaller("BundleA");
27
28 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
29 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
30
31 bundleA.Install();
32 bundleA.VerifyRegisteredAndInPackageCache();
33 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
34 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
35
36 bundleA.Uninstall();
37 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
38 Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
39 packageAv1.VerifyTestRegistryRootDeleted();
40 }
41
42 /// <summary>
43 /// BundleA installs PackageA with slipstreamed PatchA.
44 /// BundleOnlyPatchA is installed which contains PatchA (which should be a no-op).
45 /// BundleOnlyPatchA in uninstalled which should do nothing since BundleA has a dependency on it.
46 /// Bundle is installed which should remove everything.
47 /// </summary>
48 [Fact]
49 public void ReferenceCountsSlipstreamedPatch()
50 {
51 var testRegistryValue = "PackageA";
52
53 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
54 var bundleOnlyPatchA = this.CreateBundleInstaller("BundleOnlyPatchA");
55 var bundleA = this.CreateBundleInstaller("BundleA");
56
57 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
58 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
59
60 bundleA.Install();
61 bundleA.VerifyRegisteredAndInPackageCache();
62 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
63 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
64
65 bundleOnlyPatchA.Install();
66 bundleOnlyPatchA.VerifyRegisteredAndInPackageCache();
67 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
68 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
69
70 bundleOnlyPatchA.Uninstall();
71 bundleOnlyPatchA.VerifyUnregisteredAndRemovedFromPackageCache();
72 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
73 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
74
75 bundleA.Uninstall();
76 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
77 Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
78 packageAv1.VerifyTestRegistryRootDeleted();
79 }
80
81 [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6350")]
82 public void CanInstallBundleWithSlipstreamedPatchThenRepairIt()
83 {
84 this.InstallBundleWithSlipstreamedPatchThenRepairIt(false);
85 }
86
87 [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6350")]
88 public void CanInstallReversedBundleWithSlipstreamedPatchThenRepairIt()
89 {
90 this.InstallBundleWithSlipstreamedPatchThenRepairIt(true);
91 }
92
93 private void InstallBundleWithSlipstreamedPatchThenRepairIt(bool isReversed)
94 {
95 var bundleName = isReversed ? "BundleAReverse" : "BundleA";
96 var testRegistryValue = "PackageA";
97
98 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
99 var bundleA = this.CreateBundleInstaller(bundleName);
100
101 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
102 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
103
104 bundleA.Install();
105 bundleA.VerifyRegisteredAndInPackageCache();
106 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
107 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
108
109 // Delete the installed file and registry key so we have something to repair.
110 File.Delete(packageAv1SourceCodeInstalled);
111 packageAv1.DeleteTestRegistryValue(testRegistryValue);
112
113 bundleA.Repair();
114 bundleA.VerifyRegisteredAndInPackageCache();
115 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
116 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
117
118 bundleA.Uninstall();
119 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
120 Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
121 packageAv1.VerifyTestRegistryRootDeleted();
122 }
123
124 [Fact]
125 public void CanInstallSlipstreamedPatchThroughForcedRepair()
126 {
127 this.InstallSlipstreamedPatchThroughForcedRepair(false);
128 }
129
130 [Fact]
131 public void CanInstallSlipstreamedPatchThroughReversedForcedRepair()
132 {
133 this.InstallSlipstreamedPatchThroughForcedRepair(true);
134 }
135
136 private void InstallSlipstreamedPatchThroughForcedRepair(bool isReversed)
137 {
138 var bundleName = isReversed ? "BundleAReverse" : "BundleA";
139 var testRegistryValue = "PackageA";
140
141 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
142 var bundleA = this.CreateBundleInstaller(bundleName);
143 var bundleOnlyA = this.CreateBundleInstaller("BundleOnlyA");
144 var testBAController = this.CreateTestBAController();
145
146 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
147 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
148
149 bundleOnlyA.Install();
150 bundleOnlyA.VerifyRegisteredAndInPackageCache();
151 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
152 packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
153
154 // Delete the installed file and registry key so we have something to repair.
155 File.Delete(packageAv1SourceCodeInstalled);
156 packageAv1.DeleteTestRegistryValue(testRegistryValue);
157
158 testBAController.SetPackageRequestedState("PackageA", RequestState.Repair);
159 testBAController.SetPackageRequestedState("PatchA", RequestState.Repair);
160
161 bundleA.Install();
162 bundleA.VerifyRegisteredAndInPackageCache();
163 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
164 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
165
166 testBAController.ResetPackageStates("PackageA");
167 testBAController.ResetPackageStates("PatchA");
168
169 bundleA.Uninstall();
170 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
171 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
172 packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
173
174 bundleOnlyA.Uninstall();
175 bundleOnlyA.VerifyUnregisteredAndRemovedFromPackageCache();
176 Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
177 packageAv1.VerifyTestRegistryRootDeleted();
178 }
179
180 [Fact]
181 public void CanUninstallSlipstreamedPatchAlone()
182 {
183 var testRegistryValue = "PackageA";
184
185 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
186 var bundleA = this.CreateBundleInstaller("BundleA");
187 var testBAController = this.CreateTestBAController();
188
189 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
190 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
191
192 bundleA.Install();
193 bundleA.VerifyRegisteredAndInPackageCache();
194 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
195 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
196
197 testBAController.SetPackageRequestedState("PatchA", RequestState.Absent);
198
199 bundleA.Modify();
200 bundleA.VerifyRegisteredAndInPackageCache();
201 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
202 packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
203
204 bundleA.Uninstall();
205 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
206 Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
207 packageAv1.VerifyTestRegistryRootDeleted();
208 }
209
210 [Fact]
211 public void CanModifyToUninstallPackageWithSlipstreamedPatch()
212 {
213 var testRegistryValue = "PackageA";
214
215 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
216 var packageBv1 = this.CreatePackageInstaller("PackageBv1");
217 var bundleB = this.CreateBundleInstaller("BundleB");
218 var testBAController = this.CreateTestBAController();
219
220 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
221 var packageBv1SourceCodeInstalled = packageBv1.GetInstalledFilePath("Package.wxs");
222 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
223 Assert.False(File.Exists(packageBv1SourceCodeInstalled), $"PackageBv1 payload should not be there on test start: {packageBv1SourceCodeInstalled}");
224
225 bundleB.Install();
226 bundleB.VerifyRegisteredAndInPackageCache();
227 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
228 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
229 Assert.True(File.Exists(packageBv1SourceCodeInstalled), String.Concat("Should have found PackageBv1 payload installed at: ", packageBv1SourceCodeInstalled));
230
231 testBAController.SetPackageRequestedState("PackageA", RequestState.Absent);
232 testBAController.SetPackageRequestedState("PatchA", RequestState.Absent);
233
234 bundleB.Modify();
235 bundleB.VerifyRegisteredAndInPackageCache();
236 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should have been removed by modify from: {packageAv1SourceCodeInstalled}");
237
238 testBAController.ResetPackageStates("PackageA");
239 testBAController.ResetPackageStates("PatchA");
240
241 bundleB.Uninstall();
242 bundleB.VerifyUnregisteredAndRemovedFromPackageCache();
243 Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("PackageBv1 payload should have been removed by uninstall from: ", packageBv1SourceCodeInstalled));
244 packageBv1.VerifyTestRegistryRootDeleted();
245 }
246
247 [Fact]
248 public void UninstallsPackageWithSlipstreamedPatchDuringRollback()
249 {
250 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
251 var packageBv1 = this.CreatePackageInstaller("PackageBv1");
252 var bundleB = this.CreateBundleInstaller("BundleB");
253 var testBAController = this.CreateTestBAController();
254
255 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
256 var packageBv1SourceCodeInstalled = packageBv1.GetInstalledFilePath("Package.wxs");
257 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
258 Assert.False(File.Exists(packageBv1SourceCodeInstalled), $"PackageBv1 payload should not be there on test start: {packageBv1SourceCodeInstalled}");
259
260 testBAController.SetPackageCancelExecuteAtProgress("PackageB", 50);
261
262 bundleB.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
263 bundleB.VerifyUnregisteredAndRemovedFromPackageCache();
264 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should have been removed by rollback from: {packageAv1SourceCodeInstalled}");
265 Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("PackageBv1 payload should not have been installed from: ", packageBv1SourceCodeInstalled));
266 packageBv1.VerifyTestRegistryRootDeleted();
267 }
268
269 [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6359")]
270 public void CanAutomaticallyPredetermineSlipstreamPatchesAtBuildTime()
271 {
272 var testRegistryValueA = "PackageA";
273 var testRegistryValueA2 = "PackageA2";
274 var testRegistryValueB = "PackageB";
275 var testRegistryValueB2 = "PackageB2";
276
277 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
278 var packageBv1 = this.CreatePackageInstaller("PackageBv1");
279 var bundleC = this.CreateBundleInstaller("BundleC");
280
281 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
282 var packageBv1SourceCodeInstalled = packageBv1.GetInstalledFilePath("Package.wxs");
283 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
284 Assert.False(File.Exists(packageBv1SourceCodeInstalled), $"PackageBv1 payload should not be there on test start: {packageBv1SourceCodeInstalled}");
285
286 bundleC.Install();
287 bundleC.VerifyRegisteredAndInPackageCache();
288 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
289 // Product A should've slipstreamed both patches.
290 packageAv1.VerifyTestRegistryValue(testRegistryValueA, V101);
291 packageAv1.VerifyTestRegistryValue(testRegistryValueA2, V101);
292 // Product B should've only slipstreamed patch AB2.
293 packageBv1.VerifyTestRegistryValue(testRegistryValueB, V100);
294 packageBv1.VerifyTestRegistryValue(testRegistryValueB2, V101);
295
296 bundleC.Uninstall();
297 bundleC.VerifyUnregisteredAndRemovedFromPackageCache();
298 Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
299 Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("PackageBv1 payload should have been removed by uninstall from: ", packageBv1SourceCodeInstalled));
300 packageAv1.VerifyTestRegistryRootDeleted();
301 }
302
303 [Fact]
304 public void CanInstallSlipstreamedPatchWithPackageDuringMajorUpgrade()
305 {
306 var testRegistryValue = "PackageA";
307
308 var packageAv0 = this.CreatePackageInstaller("PackageAv0_9_0");
309 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
310 var bundleA = this.CreateBundleInstaller("BundleA");
311
312 packageAv1.VerifyInstalled(false);
313
314 packageAv0.InstallProduct();
315 packageAv0.VerifyInstalled(true);
316 packageAv1.VerifyTestRegistryValue(testRegistryValue, V090);
317
318 bundleA.Install();
319 bundleA.VerifyRegisteredAndInPackageCache();
320 packageAv0.VerifyInstalled(false);
321 packageAv1.VerifyInstalled(true);
322 packageAv1.VerifyTestRegistryValue(testRegistryValue, V101);
323
324 bundleA.Uninstall();
325 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
326 packageAv1.VerifyInstalled(false);
327 packageAv1.VerifyTestRegistryRootDeleted();
328 }
329
330 [Fact]
331 public void RespectsSlipstreamedPatchInstallCondition()
332 {
333 var testRegistryValue = "PackageA";
334
335 var packageAv1 = this.CreatePackageInstaller("PackageAv1");
336 var bundleD = this.CreateBundleInstaller("BundleD");
337
338 var packageAv1SourceCodeInstalled = packageAv1.GetInstalledFilePath("Package.wxs");
339 Assert.False(File.Exists(packageAv1SourceCodeInstalled), $"PackageAv1 payload should not be there on test start: {packageAv1SourceCodeInstalled}");
340
341 bundleD.Install();
342 bundleD.VerifyRegisteredAndInPackageCache();
343 Assert.True(File.Exists(packageAv1SourceCodeInstalled), String.Concat("Should have found PackageAv1 payload installed at: ", packageAv1SourceCodeInstalled));
344 // The patch was not supposed to be installed.
345 packageAv1.VerifyTestRegistryValue(testRegistryValue, V100);
346
347 bundleD.Uninstall();
348 bundleD.VerifyUnregisteredAndRemovedFromPackageCache();
349 Assert.False(File.Exists(packageAv1SourceCodeInstalled), String.Concat("PackageAv1 payload should have been removed by uninstall from: ", packageAv1SourceCodeInstalled));
350 packageAv1.VerifyTestRegistryRootDeleted();
351 }
352 }
353}