diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-04-22 16:56:21 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-23 15:40:21 -0500 |
| commit | a981e29d7a3df566754356c3fe1eb938a5cac4c1 (patch) | |
| tree | 9d2b2abac872ae3c4917003812951e68b72e7163 /src/test | |
| parent | 72e20f682c0d64102e86439ba5527dd0d71932ae (diff) | |
| download | wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.tar.gz wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.tar.bz2 wix-a981e29d7a3df566754356c3fe1eb938a5cac4c1.zip | |
Make the estimated size in ARP a little more accurate.
Fixes 4039
Diffstat (limited to 'src/test')
7 files changed, 63 insertions, 11 deletions
diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs index fdbcc6d4..b4d74341 100644 --- a/src/test/burn/TestBA/TestBA.cs +++ b/src/test/burn/TestBA/TestBA.cs | |||
| @@ -27,6 +27,7 @@ namespace WixToolset.Test.BA | |||
| 27 | 27 | ||
| 28 | private string updateBundlePath; | 28 | private string updateBundlePath; |
| 29 | 29 | ||
| 30 | private bool forceKeepRegistration; | ||
| 30 | private bool immediatelyQuit; | 31 | private bool immediatelyQuit; |
| 31 | private bool quitAfterDetect; | 32 | private bool quitAfterDetect; |
| 32 | private bool explicitlyElevateAndPlanFromOnElevateBegin; | 33 | private bool explicitlyElevateAndPlanFromOnElevateBegin; |
| @@ -131,6 +132,12 @@ namespace WixToolset.Test.BA | |||
| 131 | this.explicitlyElevateAndPlanFromOnElevateBegin = false; | 132 | this.explicitlyElevateAndPlanFromOnElevateBegin = false; |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 135 | string forceKeepRegistration = this.ReadPackageAction(null, "ForceKeepRegistration"); | ||
| 136 | if (String.IsNullOrEmpty(forceKeepRegistration) || !Boolean.TryParse(forceKeepRegistration, out this.forceKeepRegistration)) | ||
| 137 | { | ||
| 138 | this.forceKeepRegistration = false; | ||
| 139 | } | ||
| 140 | |||
| 134 | string quitAfterDetect = this.ReadPackageAction(null, "QuitAfterDetect"); | 141 | string quitAfterDetect = this.ReadPackageAction(null, "QuitAfterDetect"); |
| 135 | if (String.IsNullOrEmpty(quitAfterDetect) || !Boolean.TryParse(quitAfterDetect, out this.quitAfterDetect)) | 142 | if (String.IsNullOrEmpty(quitAfterDetect) || !Boolean.TryParse(quitAfterDetect, out this.quitAfterDetect)) |
| 136 | { | 143 | { |
| @@ -533,6 +540,16 @@ namespace WixToolset.Test.BA | |||
| 533 | this.ShutdownUiThread(); | 540 | this.ShutdownUiThread(); |
| 534 | } | 541 | } |
| 535 | 542 | ||
| 543 | protected override void OnUnregisterBegin(UnregisterBeginEventArgs args) | ||
| 544 | { | ||
| 545 | if (this.forceKeepRegistration && args.RegistrationType == RegistrationType.None) | ||
| 546 | { | ||
| 547 | args.RegistrationType = RegistrationType.InProgress; | ||
| 548 | } | ||
| 549 | |||
| 550 | this.Log("OnUnregisterBegin, default: {0}, requested: {1}", args.RecommendedRegistrationType, args.RegistrationType); | ||
| 551 | } | ||
| 552 | |||
| 536 | private void TestVariables() | 553 | private void TestVariables() |
| 537 | { | 554 | { |
| 538 | // First make sure we can check and get standard variables of each type. | 555 | // First make sure we can check and get standard variables of each type. |
diff --git a/src/test/burn/WixTestTools/BundleVerifier.cs b/src/test/burn/WixTestTools/BundleVerifier.cs index 56044c5f..594b19aa 100644 --- a/src/test/burn/WixTestTools/BundleVerifier.cs +++ b/src/test/burn/WixTestTools/BundleVerifier.cs | |||
| @@ -87,7 +87,7 @@ namespace WixTestTools | |||
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | public string VerifyRegisteredAndInPackageCache(int? expectedSystemComponent = null) | 90 | public BundleRegistration VerifyRegisteredAndInPackageCache(int? expectedSystemComponent = null) |
| 91 | { | 91 | { |
| 92 | Assert.True(this.TryGetRegistration(out var registration)); | 92 | Assert.True(this.TryGetRegistration(out var registration)); |
| 93 | 93 | ||
| @@ -99,7 +99,7 @@ namespace WixTestTools | |||
| 99 | var expectedCachePath = this.GetExpectedCachedBundlePath(); | 99 | var expectedCachePath = this.GetExpectedCachedBundlePath(); |
| 100 | WixAssert.StringEqual(expectedCachePath, registration.CachePath, true); | 100 | WixAssert.StringEqual(expectedCachePath, registration.CachePath, true); |
| 101 | 101 | ||
| 102 | return registration.CachePath; | 102 | return registration; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | public void VerifyUnregisteredAndRemovedFromPackageCache() | 105 | public void VerifyUnregisteredAndRemovedFromPackageCache() |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs index 89c5be9b..efe4f05b 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/BasicFunctionalityTests.cs | |||
| @@ -82,7 +82,8 @@ namespace WixToolsetTest.BurnE2E | |||
| 82 | 82 | ||
| 83 | bundle.Install(); | 83 | bundle.Install(); |
| 84 | 84 | ||
| 85 | var cachedBundlePath = bundle.VerifyRegisteredAndInPackageCache(); | 85 | var registration = bundle.VerifyRegisteredAndInPackageCache(); |
| 86 | var cachedBundlePath = registration.CachePath; | ||
| 86 | 87 | ||
| 87 | // Source file should be installed | 88 | // Source file should be installed |
| 88 | Assert.True(File.Exists(packageSourceCodeInstalled), $"Should have found {packageName} payload installed at: {packageSourceCodeInstalled}"); | 89 | Assert.True(File.Exists(packageSourceCodeInstalled), $"Should have found {packageName} payload installed at: {packageSourceCodeInstalled}"); |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs index 943939e3..4d5fb811 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/CacheTests.cs | |||
| @@ -162,14 +162,14 @@ namespace WixToolsetTest.BurnE2E | |||
| 162 | bundleA.Install(bundleACopiedPath); | 162 | bundleA.Install(bundleACopiedPath); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | var bundlePackageCachePath = bundleA.VerifyRegisteredAndInPackageCache(); | 165 | var bundlePackageRegistration = bundleA.VerifyRegisteredAndInPackageCache(); |
| 166 | 166 | ||
| 167 | packageA.VerifyInstalled(true); | 167 | packageA.VerifyInstalled(true); |
| 168 | packageB.VerifyInstalled(false); | 168 | packageB.VerifyInstalled(false); |
| 169 | 169 | ||
| 170 | testBAController.SetPackageRequestedState("PackageB", RequestState.Present); | 170 | testBAController.SetPackageRequestedState("PackageB", RequestState.Present); |
| 171 | 171 | ||
| 172 | var modifyLogPath = bundleA.Modify(bundlePackageCachePath); | 172 | var modifyLogPath = bundleA.Modify(bundlePackageRegistration.CachePath); |
| 173 | bundleA.VerifyRegisteredAndInPackageCache(); | 173 | bundleA.VerifyRegisteredAndInPackageCache(); |
| 174 | 174 | ||
| 175 | packageA.VerifyInstalled(true); | 175 | packageA.VerifyInstalled(true); |
| @@ -204,14 +204,14 @@ namespace WixToolsetTest.BurnE2E | |||
| 204 | 204 | ||
| 205 | bundleB.Install(bundleBCopiedPath); | 205 | bundleB.Install(bundleBCopiedPath); |
| 206 | 206 | ||
| 207 | var bundlePackageCachePath = bundleB.VerifyRegisteredAndInPackageCache(); | 207 | var bundlePackageRegistration = bundleB.VerifyRegisteredAndInPackageCache(); |
| 208 | 208 | ||
| 209 | packageA.VerifyInstalled(true); | 209 | packageA.VerifyInstalled(true); |
| 210 | packageB.VerifyInstalled(false); | 210 | packageB.VerifyInstalled(false); |
| 211 | 211 | ||
| 212 | testBAController.SetPackageRequestedState("PackageB", RequestState.Present); | 212 | testBAController.SetPackageRequestedState("PackageB", RequestState.Present); |
| 213 | 213 | ||
| 214 | bundleB.Modify(bundlePackageCachePath); | 214 | bundleB.Modify(bundlePackageRegistration.CachePath); |
| 215 | bundleB.VerifyRegisteredAndInPackageCache(); | 215 | bundleB.VerifyRegisteredAndInPackageCache(); |
| 216 | 216 | ||
| 217 | packageA.VerifyInstalled(true); | 217 | packageA.VerifyInstalled(true); |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/MsiTransactionTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/MsiTransactionTests.cs index 3d9748bb..cbfee806 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/MsiTransactionTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/MsiTransactionTests.cs | |||
| @@ -42,7 +42,7 @@ namespace WixToolsetTest.BurnE2E | |||
| 42 | 42 | ||
| 43 | bundleAv1.Install(); | 43 | bundleAv1.Install(); |
| 44 | 44 | ||
| 45 | var bundleAv1CachedPath = bundleAv1.VerifyRegisteredAndInPackageCache(); | 45 | var bundleAv1Registration = bundleAv1.VerifyRegisteredAndInPackageCache(); |
| 46 | 46 | ||
| 47 | // Source file should be installed | 47 | // Source file should be installed |
| 48 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | 48 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); |
| @@ -51,7 +51,7 @@ namespace WixToolsetTest.BurnE2E | |||
| 51 | 51 | ||
| 52 | bundleAv2.Install(); | 52 | bundleAv2.Install(); |
| 53 | 53 | ||
| 54 | var bundleAv2CachedPath = bundleAv2.VerifyRegisteredAndInPackageCache(); | 54 | var bundleAv2Registration = bundleAv2.VerifyRegisteredAndInPackageCache(); |
| 55 | 55 | ||
| 56 | // Source file should be upgraded | 56 | // Source file should be upgraded |
| 57 | Assert.True(File.Exists(packageDSourceCodeInstalled), String.Concat("Should have found Package D payload installed at: ", packageDSourceCodeInstalled)); | 57 | Assert.True(File.Exists(packageDSourceCodeInstalled), String.Concat("Should have found Package D payload installed at: ", packageDSourceCodeInstalled)); |
| @@ -61,7 +61,7 @@ namespace WixToolsetTest.BurnE2E | |||
| 61 | Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("Package Bv1 payload should have been removed by upgrade uninstall from: ", packageBv1SourceCodeInstalled)); | 61 | Assert.False(File.Exists(packageBv1SourceCodeInstalled), String.Concat("Package Bv1 payload should have been removed by upgrade uninstall from: ", packageBv1SourceCodeInstalled)); |
| 62 | Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by upgrade uninstall from: ", packageASourceCodeInstalled)); | 62 | Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by upgrade uninstall from: ", packageASourceCodeInstalled)); |
| 63 | 63 | ||
| 64 | bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache(bundleAv1CachedPath); | 64 | bundleAv1.VerifyUnregisteredAndRemovedFromPackageCache(bundleAv1Registration.CachePath); |
| 65 | 65 | ||
| 66 | // Uninstall everything. | 66 | // Uninstall everything. |
| 67 | bundleAv2.Uninstall(); | 67 | bundleAv2.Uninstall(); |
| @@ -71,7 +71,7 @@ namespace WixToolsetTest.BurnE2E | |||
| 71 | Assert.False(File.Exists(packageBv2SourceCodeInstalled), String.Concat("Package Bv2 payload should have been removed by uninstall from: ", packageBv2SourceCodeInstalled)); | 71 | Assert.False(File.Exists(packageBv2SourceCodeInstalled), String.Concat("Package Bv2 payload should have been removed by uninstall from: ", packageBv2SourceCodeInstalled)); |
| 72 | Assert.False(File.Exists(packageCv2SourceCodeInstalled), String.Concat("Package Cv2 payload should have been removed by uninstall from: ", packageCv2SourceCodeInstalled)); | 72 | Assert.False(File.Exists(packageCv2SourceCodeInstalled), String.Concat("Package Cv2 payload should have been removed by uninstall from: ", packageCv2SourceCodeInstalled)); |
| 73 | 73 | ||
| 74 | bundleAv2.VerifyUnregisteredAndRemovedFromPackageCache(bundleAv2CachedPath); | 74 | bundleAv2.VerifyUnregisteredAndRemovedFromPackageCache(bundleAv2Registration.CachePath); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | /// <summary> | 77 | /// <summary> |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs index 51122c28..01ffa942 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/RegistrationTests.cs | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | namespace WixToolsetTest.BurnE2E | 3 | namespace WixToolsetTest.BurnE2E |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using WixToolset.Mba.Core; | ||
| 6 | using Xunit; | 7 | using Xunit; |
| 7 | using Xunit.Abstractions; | 8 | using Xunit.Abstractions; |
| 8 | 9 | ||
| @@ -11,8 +12,35 @@ namespace WixToolsetTest.BurnE2E | |||
| 11 | public RegistrationTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | 12 | public RegistrationTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } |
| 12 | 13 | ||
| 13 | [Fact] | 14 | [Fact] |
| 15 | public void AllowsBAToKeepRegistration() | ||
| 16 | { | ||
| 17 | this.CreatePackageInstaller("PackageA"); | ||
| 18 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
| 19 | var testBAController = this.CreateTestBAController(); | ||
| 20 | |||
| 21 | testBAController.SetPackageRequestedState("PackageA", RequestState.Absent); | ||
| 22 | testBAController.SetForceKeepRegistration(); | ||
| 23 | |||
| 24 | bundleA.Install(); | ||
| 25 | var initialRegistration = bundleA.VerifyRegisteredAndInPackageCache(); | ||
| 26 | |||
| 27 | Assert.NotNull(initialRegistration.EstimatedSize); | ||
| 28 | |||
| 29 | testBAController.SetForceKeepRegistration(null); | ||
| 30 | testBAController.ResetPackageStates("PackageA"); | ||
| 31 | |||
| 32 | bundleA.Install(); | ||
| 33 | var finalRegistration = bundleA.VerifyRegisteredAndInPackageCache(); | ||
| 34 | |||
| 35 | // Verifies https://github.com/wixtoolset/issues/issues/4039 | ||
| 36 | Assert.NotNull(finalRegistration.EstimatedSize); | ||
| 37 | Assert.InRange(finalRegistration.EstimatedSize.Value, initialRegistration.EstimatedSize.Value + 1, Int32.MaxValue); | ||
| 38 | } | ||
| 39 | |||
| 40 | [Fact] | ||
| 14 | public void AutomaticallyUncachesBundleWhenNotInstalled() | 41 | public void AutomaticallyUncachesBundleWhenNotInstalled() |
| 15 | { | 42 | { |
| 43 | this.CreatePackageInstaller("PackageA"); | ||
| 16 | var bundleA = this.CreateBundleInstaller("BundleA"); | 44 | var bundleA = this.CreateBundleInstaller("BundleA"); |
| 17 | var testBAController = this.CreateTestBAController(); | 45 | var testBAController = this.CreateTestBAController(); |
| 18 | 46 | ||
| @@ -40,6 +68,7 @@ namespace WixToolsetTest.BurnE2E | |||
| 40 | [Fact] | 68 | [Fact] |
| 41 | public void RegistersInARPIfPrecached() | 69 | public void RegistersInARPIfPrecached() |
| 42 | { | 70 | { |
| 71 | this.CreatePackageInstaller("PackageA"); | ||
| 43 | var bundleA = this.CreateBundleInstaller("BundleA"); | 72 | var bundleA = this.CreateBundleInstaller("BundleA"); |
| 44 | 73 | ||
| 45 | bundleA.ManuallyCache(); | 74 | bundleA.ManuallyCache(); |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs b/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs index fa553919..8e6611a2 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/TestBAController.cs | |||
| @@ -47,6 +47,11 @@ namespace WixToolsetTest.BurnE2E | |||
| 47 | this.SetBurnTestValue("ExplicitlyElevateAndPlanFromOnElevateBegin", value); | 47 | this.SetBurnTestValue("ExplicitlyElevateAndPlanFromOnElevateBegin", value); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | public void SetForceKeepRegistration(string value = "true") | ||
| 51 | { | ||
| 52 | this.SetBurnTestValue("ForceKeepRegistration", value); | ||
| 53 | } | ||
| 54 | |||
| 50 | public void SetImmediatelyQuit(string value = "true") | 55 | public void SetImmediatelyQuit(string value = "true") |
| 51 | { | 56 | { |
| 52 | this.SetBurnTestValue("ImmediatelyQuit", value); | 57 | this.SetBurnTestValue("ImmediatelyQuit", value); |
