diff options
| author | Rob Mensching <rob@firegiant.com> | 2025-02-11 13:53:50 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2025-02-11 15:49:33 -0800 |
| commit | 040e50ec2859c1de70cd8e9f957474321774f293 (patch) | |
| tree | cebfe14eccdb3884d5eefc443b285917b6b4a38b /src/test/burn/WixToolsetTest.BurnE2E | |
| parent | ccfed95b510f7cd1b205379d0cec50de69c2d850 (diff) | |
| download | wix-040e50ec2859c1de70cd8e9f957474321774f293.tar.gz wix-040e50ec2859c1de70cd8e9f957474321774f293.tar.bz2 wix-040e50ec2859c1de70cd8e9f957474321774f293.zip | |
Rewrite Prereq tests after hardening and bypassing .NET GUI errors
Diffstat (limited to 'src/test/burn/WixToolsetTest.BurnE2E')
| -rw-r--r-- | src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs | 212 |
1 files changed, 39 insertions, 173 deletions
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs index 4fccb0e9..bc21458d 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs | |||
| @@ -12,22 +12,21 @@ namespace WixToolsetTest.BurnE2E | |||
| 12 | { | 12 | { |
| 13 | public PrereqBaTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | 13 | public PrereqBaTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } |
| 14 | 14 | ||
| 15 | const int E_PREREQBA_INFINITE_LOOP = -2_114_714_646; | ||
| 16 | |||
| 17 | /// <summary> | 15 | /// <summary> |
| 18 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | 16 | /// This bundle purposely misnames its .runtimeconfig.json file to force the PreqBA to kick in |
| 19 | /// with an MSI package to represent the prerequisite package. | 17 | /// and use its EXE prereq package to swap in a good one. |
| 20 | /// This verifies that: | 18 | /// This verifies that: |
| 21 | /// The preqba doesn't infinitely try to install prereqs. | 19 | /// The mangaged BA fails to load due to the missing file. |
| 22 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. | 20 | /// The preqba kicks in to copy in the file. |
| 21 | /// The managed BA gets loaded. | ||
| 23 | /// </summary> | 22 | /// </summary> |
| 24 | [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")] | 23 | [RuntimeFact] |
| 25 | public void DncAlwaysPreqBaDetectsInfiniteLoop() | 24 | public void DncLoadsOnlyAfterInstallingPrereqs() |
| 26 | { | 25 | { |
| 27 | var packageA = this.CreatePackageInstaller("PackageA"); | 26 | var packageA = this.CreatePackageInstaller("PackageA"); |
| 28 | var packageC = this.CreatePackageInstaller("PackageC"); | 27 | var packageC = this.CreatePackageInstaller("PackageC"); |
| 29 | 28 | ||
| 30 | var bundleC = this.CreateBundleInstaller("BundleC"); | 29 | var bundleA = this.CreateBundleInstaller("BundleA"); |
| 31 | 30 | ||
| 32 | var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); | 31 | var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); |
| 33 | 32 | ||
| @@ -35,60 +34,28 @@ namespace WixToolsetTest.BurnE2E | |||
| 35 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); | 34 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); |
| 36 | packageC.VerifyInstalled(false); | 35 | packageC.VerifyInstalled(false); |
| 37 | 36 | ||
| 38 | bundleC.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); | 37 | bundleA.Install(); |
| 39 | |||
| 40 | // Part of the test is Install actually completing. | ||
| 41 | 38 | ||
| 42 | // Source file should be installed | 39 | // Source file should be installed |
| 43 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | 40 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); |
| 44 | packageC.VerifyInstalled(false); | 41 | packageC.VerifyInstalled(true); |
| 45 | |||
| 46 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | ||
| 47 | bundleC.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
| 48 | } | ||
| 49 | |||
| 50 | /// <summary> | ||
| 51 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | ||
| 52 | /// with an MSI package to represent the prerequisite package. | ||
| 53 | /// This verifies that: | ||
| 54 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. | ||
| 55 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. | ||
| 56 | /// </summary> | ||
| 57 | [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")] | ||
| 58 | public void DncPreqBaDetectsInfiniteLoop() | ||
| 59 | { | ||
| 60 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
| 61 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
| 62 | |||
| 63 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
| 64 | |||
| 65 | var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); | ||
| 66 | |||
| 67 | // Source file should *not* be installed | ||
| 68 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); | ||
| 69 | packageC.VerifyInstalled(false); | ||
| 70 | |||
| 71 | bundleA.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); | ||
| 72 | 42 | ||
| 73 | // Part of the test is Install actually completing. | 43 | bundleA.VerifyRegisteredAndInPackageCache(); |
| 74 | 44 | ||
| 75 | // Source file should be installed | 45 | bundleA.Uninstall(); |
| 76 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | ||
| 77 | packageC.VerifyInstalled(false); | ||
| 78 | 46 | ||
| 79 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | ||
| 80 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | 47 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); |
| 81 | } | 48 | } |
| 82 | 49 | ||
| 83 | /// <summary> | 50 | /// <summary> |
| 84 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | 51 | /// This bundle purposely misnames its .runtimeconfig.json file to force the PreqBA to kick in |
| 85 | /// with an EXE prereq package to swap it out with a good one. | 52 | /// and use its EXE prereq package to swap in a good one. |
| 86 | /// This verifies that: | 53 | /// This verifies that: |
| 87 | /// The preqba doesn't infinitely try to install prereqs. | 54 | /// The preqba runs first to fix the file. |
| 88 | /// The managed BA gets loaded after installing prereqs. | 55 | /// The managed BA gets loaded on first try. |
| 89 | /// </summary> | 56 | /// </summary> |
| 90 | [RuntimeFact] | 57 | [RuntimeFact] |
| 91 | public void DncAlwaysPreqBaLoadsManagedBaAfterInstallingPrereqs() | 58 | public void DncPreqsFirstThenBaLoadsManagedBa() |
| 92 | { | 59 | { |
| 93 | var packageA = this.CreatePackageInstaller("PackageA"); | 60 | var packageA = this.CreatePackageInstaller("PackageA"); |
| 94 | var packageC = this.CreatePackageInstaller("PackageC"); | 61 | var packageC = this.CreatePackageInstaller("PackageC"); |
| @@ -114,64 +81,20 @@ namespace WixToolsetTest.BurnE2E | |||
| 114 | bundleC.VerifyUnregisteredAndRemovedFromPackageCache(); | 81 | bundleC.VerifyUnregisteredAndRemovedFromPackageCache(); |
| 115 | } | 82 | } |
| 116 | 83 | ||
| 117 | /// <summary> | 84 | /// This bundle purposely misnames its WixToolset.Mba.Host.config file to force the PreqBA to kick in |
| 118 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | 85 | /// and use its EXE prereq package to swap in a good one. |
| 119 | /// with an EXE prereq package to swap it out with a good one. | ||
| 120 | /// This verifies that: | 86 | /// This verifies that: |
| 121 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. | 87 | /// The mangaged BA fails to load due to the missing file. |
| 122 | /// The managed BA gets loaded after installing prereqs. | 88 | /// The preqba kicks in to copy in the file. |
| 89 | /// The managed BA gets loaded. | ||
| 123 | /// </summary> | 90 | /// </summary> |
| 124 | [RuntimeFact] | 91 | [RuntimeFact(Skip = "It is no longer possible to replace the bad.config with a good config, these tests do not work for .NET Framework the way they can for .NET above.")] |
| 125 | public void DncPreqBaLoadsManagedBaAfterInstallingPrereqs() | 92 | public void MbaLoadsOnlyAfterInstallingPrereqs() |
| 126 | { | ||
| 127 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
| 128 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
| 129 | |||
| 130 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
| 131 | |||
| 132 | var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); | ||
| 133 | |||
| 134 | // Source file should *not* be installed | ||
| 135 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); | ||
| 136 | packageC.VerifyInstalled(false); | ||
| 137 | |||
| 138 | bundleA.Install(); | ||
| 139 | |||
| 140 | // Source file should be installed | ||
| 141 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | ||
| 142 | packageC.VerifyInstalled(true); | ||
| 143 | |||
| 144 | bundleA.VerifyRegisteredAndInPackageCache(); | ||
| 145 | |||
| 146 | bundleA.Uninstall(); | ||
| 147 | |||
| 148 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
| 149 | } | ||
| 150 | |||
| 151 | [RuntimeFact] | ||
| 152 | public void DncAlwaysPreqBaForwardsHelpToManagedBa() | ||
| 153 | { | ||
| 154 | var bundleE = this.CreateBundleInstaller("BundleE"); | ||
| 155 | |||
| 156 | var bundleLog = bundleE.Help(); | ||
| 157 | |||
| 158 | Assert.True(LogVerifier.MessageInLogFile(bundleLog, "This is a BA for automated testing")); | ||
| 159 | } | ||
| 160 | |||
| 161 | /// <summary> | ||
| 162 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | ||
| 163 | /// with an MSI package to represent the prerequisite package. | ||
| 164 | /// This verifies that: | ||
| 165 | /// The preqba doesn't infinitely try to install prereqs. | ||
| 166 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. | ||
| 167 | /// </summary> | ||
| 168 | [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")] | ||
| 169 | public void MbaAlwaysPreqBaDetectsInfiniteLoop() | ||
| 170 | { | 93 | { |
| 171 | var packageB = this.CreatePackageInstaller("PackageB"); | 94 | var packageB = this.CreatePackageInstaller("PackageB"); |
| 172 | var packageC = this.CreatePackageInstaller("PackageC"); | 95 | var packageC = this.CreatePackageInstaller("PackageC"); |
| 173 | 96 | ||
| 174 | var bundleD = this.CreateBundleInstaller("BundleD"); | 97 | var bundleB = this.CreateBundleInstaller("BundleB"); |
| 175 | 98 | ||
| 176 | var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); | 99 | var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); |
| 177 | 100 | ||
| @@ -179,60 +102,28 @@ namespace WixToolsetTest.BurnE2E | |||
| 179 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); | 102 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); |
| 180 | packageC.VerifyInstalled(false); | 103 | packageC.VerifyInstalled(false); |
| 181 | 104 | ||
| 182 | bundleD.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); | 105 | bundleB.Install(); |
| 183 | |||
| 184 | // Part of the test is Install actually completing. | ||
| 185 | 106 | ||
| 186 | // Source file should be installed | 107 | // Source file should be installed |
| 187 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); | 108 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); |
| 188 | packageC.VerifyInstalled(false); | 109 | packageC.VerifyInstalled(true); |
| 189 | |||
| 190 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | ||
| 191 | bundleD.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
| 192 | } | ||
| 193 | |||
| 194 | /// <summary> | ||
| 195 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | ||
| 196 | /// with an MSI package to represent the prerequisite package. | ||
| 197 | /// This verifies that: | ||
| 198 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. | ||
| 199 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. | ||
| 200 | /// </summary> | ||
| 201 | [RuntimeFact(Skip = ".NET displays a message box when runtime is not present on the machine which hangs on CI systems. Skip this test until we can get a different behavior from .NET")] | ||
| 202 | public void MbaPreqBaDetectsInfiniteLoop() | ||
| 203 | { | ||
| 204 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
| 205 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
| 206 | |||
| 207 | var bundleB = this.CreateBundleInstaller("BundleB"); | ||
| 208 | |||
| 209 | var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); | ||
| 210 | |||
| 211 | // Source file should *not* be installed | ||
| 212 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); | ||
| 213 | packageC.VerifyInstalled(false); | ||
| 214 | |||
| 215 | bundleB.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); | ||
| 216 | 110 | ||
| 217 | // Part of the test is Install actually completing. | 111 | bundleB.VerifyRegisteredAndInPackageCache(); |
| 218 | 112 | ||
| 219 | // Source file should be installed | 113 | bundleB.Uninstall(); |
| 220 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); | ||
| 221 | packageC.VerifyInstalled(false); | ||
| 222 | 114 | ||
| 223 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | 115 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. |
| 224 | bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); | 116 | bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); |
| 225 | } | 117 | } |
| 226 | 118 | ||
| 227 | /// <summary> | 119 | /// This bundle purposely misnames its WixToolset.Mba.Host.config file to force the PreqBA to kick in |
| 228 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | 120 | /// and use its EXE prereq package to swap in a good one. |
| 229 | /// with an EXE prereq package to swap it out with a good one. | ||
| 230 | /// This verifies that: | 121 | /// This verifies that: |
| 231 | /// The preqba doesn't infinitely try to install prereqs. | 122 | /// The preqba runs first to fix the file. |
| 232 | /// The managed BA gets loaded after installing prereqs. | 123 | /// The managed BA gets loaded on first try. |
| 233 | /// </summary> | 124 | /// </summary> |
| 234 | [RuntimeFact] | 125 | [RuntimeFact(Skip = "It is no longer possible to replace the bad.config with a good config, these tests do not work for .NET Framework the way they can for .NET above.")] |
| 235 | public void MbaAlwaysPreqBaLoadsManagedBaAfterInstallingPrereqs() | 126 | public void MbaPreqsFirstThenBaLoadsManagedBa() |
| 236 | { | 127 | { |
| 237 | var packageB = this.CreatePackageInstaller("PackageB"); | 128 | var packageB = this.CreatePackageInstaller("PackageB"); |
| 238 | var packageC = this.CreatePackageInstaller("PackageC"); | 129 | var packageC = this.CreatePackageInstaller("PackageC"); |
| @@ -258,39 +149,14 @@ namespace WixToolsetTest.BurnE2E | |||
| 258 | bundleD.VerifyUnregisteredAndRemovedFromPackageCache(); | 149 | bundleD.VerifyUnregisteredAndRemovedFromPackageCache(); |
| 259 | } | 150 | } |
| 260 | 151 | ||
| 261 | /// <summary> | ||
| 262 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | ||
| 263 | /// with an EXE prereq package to swap it out with a good one. | ||
| 264 | /// This verifies that: | ||
| 265 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. | ||
| 266 | /// The managed BA gets loaded after installing prereqs. | ||
| 267 | /// </summary> | ||
| 268 | [RuntimeFact] | 152 | [RuntimeFact] |
| 269 | public void MbaPreqBaLoadsManagedBaAfterInstallingPrereqs() | 153 | public void DncAlwaysPreqBaForwardsHelpToManagedBa() |
| 270 | { | 154 | { |
| 271 | var packageB = this.CreatePackageInstaller("PackageB"); | 155 | var bundleE = this.CreateBundleInstaller("BundleE"); |
| 272 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
| 273 | |||
| 274 | var bundleB = this.CreateBundleInstaller("BundleB"); | ||
| 275 | |||
| 276 | var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); | ||
| 277 | |||
| 278 | // Source file should *not* be installed | ||
| 279 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); | ||
| 280 | packageC.VerifyInstalled(false); | ||
| 281 | |||
| 282 | bundleB.Install(); | ||
| 283 | |||
| 284 | // Source file should be installed | ||
| 285 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); | ||
| 286 | packageC.VerifyInstalled(true); | ||
| 287 | |||
| 288 | bundleB.VerifyRegisteredAndInPackageCache(); | ||
| 289 | 156 | ||
| 290 | bundleB.Uninstall(); | 157 | var bundleLog = bundleE.Help(); |
| 291 | 158 | ||
| 292 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | 159 | Assert.True(LogVerifier.MessageInLogFile(bundleLog, "This is a BA for automated testing")); |
| 293 | bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
| 294 | } | 160 | } |
| 295 | } | 161 | } |
| 296 | } | 162 | } |
