feat(launcher): complete Campaign LA11 pre-gate support
This commit is contained in:
parent
f881e5b467
commit
134edabed2
19 changed files with 433 additions and 55 deletions
|
|
@ -279,25 +279,43 @@ public sealed class LauncherSelfUpdateManagerTests : IDisposable
|
|||
public async Task BootstrapConfirmationAndOrdinaryStartupDoNotUseShellParsing()
|
||||
{
|
||||
using var harness = new Harness(_root);
|
||||
string[] publicArguments =
|
||||
[
|
||||
"--config-dir", Path.Combine(_root, "config with spaces"),
|
||||
"--data-dir", Path.Combine(_root, "data & literal"),
|
||||
"--cache-dir", Path.Combine(_root, "cache"),
|
||||
"--update-manifest-uri", "http://127.0.0.1:43119/manifest.json",
|
||||
];
|
||||
SelfUpdateStartupResult ordinary = await LauncherSelfUpdateBootstrap.HandleAsync(
|
||||
["--literal", "argument with spaces & metacharacters"],
|
||||
publicArguments,
|
||||
harness.Manager,
|
||||
harness.Target,
|
||||
harness.LauncherPath);
|
||||
Assert.False(ordinary.ShouldExit);
|
||||
Assert.Equal(["--literal", "argument with spaces & metacharacters"],
|
||||
ordinary.RemainingArguments);
|
||||
Assert.Equal(publicArguments, ordinary.RemainingArguments);
|
||||
|
||||
SelfUpdateStartupResult deferred = await LauncherSelfUpdateBootstrap.HandleAsync(
|
||||
[LauncherSelfUpdateBootstrap.DeferredArgument, .. publicArguments],
|
||||
harness.Manager,
|
||||
harness.Target,
|
||||
harness.LauncherPath);
|
||||
Assert.False(deferred.ShouldExit);
|
||||
Assert.Equal(publicArguments, deferred.RemainingArguments);
|
||||
|
||||
_ = await harness.StageAsync();
|
||||
SelfUpdatePlan applied = await harness.Manager.ApplyPendingAsync(harness.Target);
|
||||
SelfUpdateStartupResult confirmation = await LauncherSelfUpdateBootstrap.HandleAsync(
|
||||
[LauncherSelfUpdateBootstrap.ConfirmArgument, applied.TransactionId],
|
||||
[
|
||||
LauncherSelfUpdateBootstrap.ConfirmArgument,
|
||||
applied.TransactionId,
|
||||
.. publicArguments,
|
||||
],
|
||||
harness.Manager,
|
||||
harness.Target,
|
||||
harness.LauncherPath);
|
||||
|
||||
Assert.False(confirmation.ShouldExit);
|
||||
Assert.Empty(confirmation.RemainingArguments);
|
||||
Assert.Equal(publicArguments, confirmation.RemainingArguments);
|
||||
Assert.False(File.Exists(harness.Manager.PendingPlanPath));
|
||||
Assert.False(harness.Manager.IsConfirmed(applied.TransactionId));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ public sealed class LauncherSelfUpdateProcessTests : IDisposable
|
|||
string ready = Path.Combine(_root, "crash.ready");
|
||||
string launched = Path.Combine(_root, "replacement.ready");
|
||||
string helperPidPath = Path.Combine(_root, "helper.pid");
|
||||
string[] processLocalSuffix =
|
||||
[
|
||||
"--config-dir", Path.Combine(_root, "isolated config"),
|
||||
"--data-dir", Path.Combine(_root, "isolated data"),
|
||||
"--cache-dir", Path.Combine(_root, "isolated cache"),
|
||||
"--update-manifest-uri", "http://127.0.0.1:43119/manifest.json",
|
||||
];
|
||||
Directory.CreateDirectory(_root);
|
||||
string rid = LauncherRuntimeIdentity.DetectRid();
|
||||
PreparedLauncher prepared = PrepareLauncherClosure(target, rid);
|
||||
|
|
@ -76,7 +83,7 @@ public sealed class LauncherSelfUpdateProcessTests : IDisposable
|
|||
};
|
||||
using Process canonical = StartProcess(
|
||||
prepared.CanonicalPath,
|
||||
["canonical-probe", launched],
|
||||
["canonical-probe", launched, .. processLocalSuffix],
|
||||
environment);
|
||||
await canonical.WaitForExitAsync().WaitAsync(TimeSpan.FromSeconds(20));
|
||||
Assert.Equal(0, canonical.ExitCode);
|
||||
|
|
@ -100,7 +107,12 @@ public sealed class LauncherSelfUpdateProcessTests : IDisposable
|
|||
SearchOption.TopDirectoryOnly));
|
||||
Assert.Null(await manager.LoadPendingAsync());
|
||||
|
||||
int replacementPid = ParsePid(await File.ReadAllTextAsync(launched));
|
||||
string launchMarker = await File.ReadAllTextAsync(launched);
|
||||
Assert.EndsWith(
|
||||
Environment.NewLine + string.Join(Environment.NewLine, processLocalSuffix),
|
||||
launchMarker,
|
||||
StringComparison.Ordinal);
|
||||
int replacementPid = ParsePid(launchMarker);
|
||||
int helperPid = int.Parse(
|
||||
await File.ReadAllTextAsync(helperPidPath),
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,26 @@ public sealed class LauncherVersionTests
|
|||
|
||||
public sealed class ReleaseManifestClientTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("https://updates.example.test/manifest.json")]
|
||||
[InlineData("http://127.0.0.1:43119/manifest.json")]
|
||||
[InlineData("http://localhost:43119/manifest.json")]
|
||||
public void LocalUpdateFeedOverrideAcceptsOnlySecureOrLoopbackFeeds(string value)
|
||||
{
|
||||
using ReleaseManifestClient source =
|
||||
ReleaseManifestClient.CreateLocalUpdateFeedOverride(new Uri(value));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("http://updates.example.test/manifest.json")]
|
||||
[InlineData("file:///tmp/manifest.json")]
|
||||
[InlineData("https://user:secret@updates.example.test/manifest.json")]
|
||||
[InlineData("https://updates.example.test/manifest.json?token=secret")]
|
||||
[InlineData("https://updates.example.test/manifest.json#fragment")]
|
||||
public void LocalUpdateFeedOverrideRejectsRemoteHttpAndCredentialLikeUris(string value) =>
|
||||
Assert.Throws<LauncherUpdateException>(() =>
|
||||
ReleaseManifestClient.CreateLocalUpdateFeedOverride(new Uri(value)));
|
||||
|
||||
[Fact]
|
||||
public async Task FetchesStrictManifestFromLoopbackAndPinsProductionFeed()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue