aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2025-04-01 16:48:38 -0400
committerBob Arnson <github@bobs.org>2025-04-03 17:24:54 -0400
commit36eb3fabd3082912d79dbeafc8c406ac6755e1b9 (patch)
treea3a670de32b5079e39e259240b8ccfbafde90c8f /src/test
parented19d167c0d3071709a72143f106dbb5efdddeba (diff)
downloadwix-36eb3fabd3082912d79dbeafc8c406ac6755e1b9.tar.gz
wix-36eb3fabd3082912d79dbeafc8c406ac6755e1b9.tar.bz2
wix-36eb3fabd3082912d79dbeafc8c406ac6755e1b9.zip
Sync IEngine.SetDownloadSource with native side.
Fixes https://github.com/wixtoolset/issues/issues/9018
Diffstat (limited to 'src/test')
-rw-r--r--src/test/burn/TestBA/TestBA.cs30
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs19
-rw-r--r--src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs10
3 files changed, 58 insertions, 1 deletions
diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs
index 1556acd0..4f75a055 100644
--- a/src/test/burn/TestBA/TestBA.cs
+++ b/src/test/burn/TestBA/TestBA.cs
@@ -41,6 +41,7 @@ namespace WixToolset.Test.BA
41 private int cancelOnProgressAtProgress; 41 private int cancelOnProgressAtProgress;
42 private int retryExecuteFilesInUse; 42 private int retryExecuteFilesInUse;
43 private bool rollingBack; 43 private bool rollingBack;
44 private string forceDownloadSource;
44 45
45 private IBootstrapperCommand Command { get; set; } 46 private IBootstrapperCommand Command { get; set; }
46 47
@@ -375,6 +376,12 @@ namespace WixToolset.Test.BA
375 { 376 {
376 this.Log(" CancelCacheAtProgress: {0}", this.cancelCacheAtProgress); 377 this.Log(" CancelCacheAtProgress: {0}", this.cancelCacheAtProgress);
377 } 378 }
379
380 this.forceDownloadSource = this.ReadPackageAction(args.PackageId, "ForceDownloadSource");
381 if (!String.IsNullOrEmpty(this.forceDownloadSource))
382 {
383 this.Log(" ForceDownloadSource: {0}", this.forceDownloadSource);
384 }
378 } 385 }
379 386
380 protected override void OnCachePackageNonVitalValidationFailure(CachePackageNonVitalValidationFailureEventArgs args) 387 protected override void OnCachePackageNonVitalValidationFailure(CachePackageNonVitalValidationFailureEventArgs args)
@@ -387,6 +394,29 @@ namespace WixToolset.Test.BA
387 this.Log("OnCachePackageNonVitalValidationFailure() - id: {0}, default: {1}, requested: {2}", args.PackageId, args.Recommendation, args.Action); 394 this.Log("OnCachePackageNonVitalValidationFailure() - id: {0}, default: {1}, requested: {2}", args.PackageId, args.Recommendation, args.Action);
388 } 395 }
389 396
397 protected override void OnCacheAcquireResolving(CacheAcquireResolvingEventArgs args)
398 {
399 if (!String.IsNullOrEmpty(this.forceDownloadSource))
400 {
401 args.Action = CacheResolveOperation.Download;
402 var url = String.Format(this.forceDownloadSource, args.PayloadId);
403
404 this.Log("OnCacheAcquireResolving: {0} => {1}", this.forceDownloadSource, url);
405
406 this.engine.SetDownloadSource(
407 String.Empty,
408 args.PayloadId,
409 url,
410 String.Empty,
411 String.Empty,
412 String.Empty);
413 }
414 else
415 {
416 this.Log("OnCacheAcquireResolving not forcing download");
417 }
418 }
419
390 protected override void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args) 420 protected override void OnCacheAcquireProgress(CacheAcquireProgressEventArgs args)
391 { 421 {
392 this.Log("OnCacheAcquireProgress() - container/package: {0}, payload: {1}, progress: {2}, total: {3}, overall progress: {4}%", args.PackageOrContainerId, args.PayloadId, args.Progress, args.Total, args.OverallPercentage); 422 this.Log("OnCacheAcquireProgress() - container/package: {0}, payload: {1}, progress: {2}, total: {3}, overall progress: {4}%", args.PackageOrContainerId, args.PayloadId, args.Progress, args.Total, args.OverallPercentage);
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs
index bd3762ed..4bbfc7e9 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/FailureTests.cs
@@ -2,7 +2,6 @@
2 2
3namespace WixToolsetTest.BurnE2E 3namespace WixToolsetTest.BurnE2E
4{ 4{
5 using System.Threading;
6 using WixTestTools; 5 using WixTestTools;
7 using WixToolset.BootstrapperApplicationApi; 6 using WixToolset.BootstrapperApplicationApi;
8 using Xunit; 7 using Xunit;
@@ -13,6 +12,24 @@ namespace WixToolsetTest.BurnE2E
13 public FailureTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } 12 public FailureTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
14 13
15 [RuntimeFact] 14 [RuntimeFact]
15 public void CanSetDownloadSourceAndForceDownload()
16 {
17 var packageA = this.CreatePackageInstaller("PackageA");
18 var bundleA = this.CreateBundleInstaller("BundleA");
19 var testBAController = this.CreateTestBAController();
20
21 testBAController.SetPackageForceDownloadSource("PackageA", "https://1e1bf2be1c384fd1a0c4c0500eef971b/downloads/payloads/{0}");
22
23 packageA.VerifyInstalled(false);
24
25 bundleA.VerifyUnregisteredAndRemovedFromPackageCache();
26
27 bundleA.Install(0x2ee7/*ERROR_INTERNET_NAME_NOT_RESOLVED*/);
28
29 packageA.VerifyInstalled(false);
30 }
31
32 [RuntimeFact]
16 public void CanCancelExePackageAndAbandonIt() 33 public void CanCancelExePackageAndAbandonIt()
17 { 34 {
18 var bundleD = this.CreateBundleInstaller("BundleD"); 35 var bundleD = this.CreateBundleInstaller("BundleD");
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs
index a378545e..ca395f56 100644
--- a/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs
+++ b/src/test/burn/WixToolsetTest.BurnE2E/Utilities/TestBAController.cs
@@ -108,6 +108,16 @@ namespace WixToolsetTest.BurnE2E
108 } 108 }
109 109
110 /// <summary> 110 /// <summary>
111 /// Forces a download action and sets the download source.
112 /// </summary>
113 /// <param name="packageId">Package identity.</param>
114 /// <param name="actionName">The URL format string.</param>
115 public void SetPackageForceDownloadSource(string packageId, string url)
116 {
117 this.SetPackageState(packageId, "ForceDownloadSource", url);
118 }
119
120 /// <summary>
111 /// Cancels the execute of a package at the next progess after the specified MSI action start. 121 /// Cancels the execute of a package at the next progess after the specified MSI action start.
112 /// </summary> 122 /// </summary>
113 /// <param name="packageId">Package identity.</param> 123 /// <param name="packageId">Package identity.</param>