fix: address the owner review 5 review

Setup: a kept 1.0 Uploader no longer fixes the scope and folder, the
Remove tooltip promises kept files only with a hashed log, and a
single-program setup preselects it. The Uploader always downloads the
setup. Sync links move to the server id at every sign-in while folders
wait for jobs and open editors; jobs of a pending homes sort still find
their projects. A shared library exposes only the shared archive's
client-visible jobs and events, render nodes take only client renders,
and the share counts as its own while starting. Progress: a new step
waits a quarter interval and a trailing timer publishes the last state;
the job bar tooltip carries the whole line; Recent maintenance and the
Server jobs list pick up jobs that start while they are shown.

Refs #64 #65 #66 #67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-15 16:19:56 +01:00
1 parent 817956e719
commit f30eb2904a
51 files changed
+895 -122

No files matched your search

@@ -9,6 +9,7 @@ using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Data;
using Chronos.Data.Archiving;
using Chronos.Data.Jobs;
using Chronos.Data.Repositories;
using Chronos.Testing;
using Chronos.Ui.Controls;
@@ -260,6 +261,29 @@ public sealed class ArchiveLogicTests
Assert.SequenceEqual(new[] { "sunset", "dusk" }, changes.Single().Tags);
}
[Test]
public void AMaintenanceJobQueuedWhileTheScreenIsShownJoinsRecent()
{
var archive = Guid.NewGuid();
var now = DateTimeOffset.UtcNow;
IReadOnlyList<Job> jobs = [new Job { Id = Guid.NewGuid(), Kind = JobKind.Scan, State = JobState.Done, TargetIds = [archive], Created = now.AddDays(-1), Finished = now.AddDays(-1) }];
var verify = new Job { Id = Guid.NewGuid(), Kind = JobKind.Verify, State = JobState.Queued, TargetIds = [archive], TargetLabel = "Main", Created = now };
jobs = MaintenanceReports.Track(jobs, verify, archive);
Assert.Equal(2, jobs.Count);
var running = verify with { State = JobState.Running, Started = now };
jobs = MaintenanceReports.Track(jobs, running, archive);
Assert.Equal(2, jobs.Count);
var live = new Dictionary<Guid, JobProgressInfo> { [verify.Id] = new(verify.Id, JobKind.Verify, "Main", 40, 100, null, null, null) };
var recent = MaintenanceReports.Recent(jobs, 5, live);
Assert.Equal(verify.Id, recent[0].JobId);
Assert.Equal("40 %", recent[0].StateText);
// Another archive's job, or another kind of job, leaves the list as it is.
Assert.Same(jobs, MaintenanceReports.Track(jobs, running with { Id = Guid.NewGuid(), TargetIds = [Guid.NewGuid()] }, archive));
Assert.Same(jobs, MaintenanceReports.Track(jobs, running with { Id = Guid.NewGuid(), Kind = JobKind.Render }, archive));
}
[Test]
public void ReportsListDuplicatesOrphansAndRecentMaintenance()
{
@@ -96,6 +96,21 @@ public sealed class JobTextTests
Assert.Equal("3 / 9", JobText.Counter(JobKind.Scan, 3, 9));
}
[Test]
public void TheBarsTooltipHasTheLineWholeWithItsItem()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var job = Job(JobKind.Verify, JobState.Running, "Archive") with
{
Detail = new JobDetail(JobStep.Verify, "2024/2024-09-27 Harbour sunset at the old lighthouse", 812, 2_400, 3, 41, JobPartUnit.Sequence),
};
var entry = new JobEntry(job);
// The bar cuts the line at 60 characters, dropping the sequence first; the tooltip names it.
Assert.False(JobText.Bar(entry).Contains("Harbour sunset", StringComparison.Ordinal), JobText.Bar(entry));
Assert.Equal("Verify · Archive · " + JobText.Status(job.Detail), JobText.BarToolTip(entry));
Assert.Contains("Harbour sunset at the old lighthouse", JobText.BarToolTip(entry));
}
[Test]
public void LiveDetailWinsAndStoppedJobsSayWhere()
{
@@ -64,6 +64,24 @@ public sealed class ServerJobsListTests
Assert.False(vm.HasRows);
}
[Test]
public async Task AJobThatStartedBeforeTheEventsOpenedJoinsOnItsProgress()
{
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
var api = new FakeJobsApi();
using var vm = new ServerJobsViewModel(() => new ServerJobsAccount("a", false), () => api, new IdleContext());
await UpdatedAsync(vm, vm.Refresh);
Assert.Empty(vm.Rows);
// Started between the list and the event socket: its running state was never told, its progress is.
var id = api.Add("thumbs", "Lake", "running");
await UpdatedAsync(vm, () => api.Events.Writer.TryWrite(new JobProgressEvent(id, 40, 100, 3, 20,
new JobDetailDto("thumbs", "Lake", 40, 100))));
var row = vm.Rows.Single();
Assert.Equal(id, row.Id);
Assert.Equal(40d / 100, row.Progress);
}
[Test]
public async Task AManagingAccountPausesResumesAndCancels()
{
@@ -193,6 +193,24 @@ public sealed class SingleSetupTests(TestContext context)
Assert.Null(LegacyProducts.FindUploader(Manifest("ChronosTest" + Guid.NewGuid().ToString("N")[..12])));
}
[Test]
public void ALegacyUploaderLeftInPlaceFixesNeitherTheScopeNorTheFolder()
{
var manifest = Manifest();
var root = context.CreateTempDirectory("legacy-kept");
var legacy = Legacy(Path.Combine(root, "Chronos Uploader"), InstallScope.CurrentUser);
var elsewhere = Path.Combine(root, "Apps", "Chronos");
// The Uploader is not installed, so nothing is merged: the switches decide where Chronos goes.
var plan = InstallPlan.Resolve(manifest, new SetupArguments { AllUsers = true, Directory = elsewhere, Components = ["Desktop"] }, null, null, legacy);
Assert.Equal(InstallScope.AllUsers, plan.Scope);
Assert.Equal(elsewhere, plan.Directory);
Assert.SequenceEqual(["Chronos"], plan.Components);
Assert.True(plan.CanChangeLocation);
Assert.Null(plan.LegacyToReplace(plan.Components, plan.Scope, plan.Directory));
Assert.True(plan.LocksLocation(["Chronos", "Uploader"]), "ticking the Uploader would replace the legacy one");
}
[Test]
[WindowsOnly]
public void ReplacingTheLegacyUploaderMovesItsSignInEntryAndKeepsItTurnedOff()
@@ -306,6 +324,31 @@ public sealed class SingleSetupTests(TestContext context)
Assert.False(replace.CanChangeLocation);
Assert.Equal("Replaces Chronos Uploader 1.0.0", replace.ChangesText);
Assert.False(replace.IsUninstallAll);
// Unticked, the Uploader replaces nothing: the folder and the scope can change; ticked again, they are the legacy copy's.
var uploader = Assert.Contains(replace.Components, c => c.Id == "Uploader");
uploader.IsSelected = false;
Assert.True(replace.CanChangeLocation);
replace.IsAllUsers = true;
replace.Directory = Path.Combine(root, "Apps", "Chronos");
uploader.IsSelected = true;
Assert.False(replace.CanChangeLocation);
Assert.False(replace.IsAllUsers);
Assert.Equal(SetupPaths.DefaultDirectory(InstallScope.CurrentUser, manifest.Product), replace.Directory);
}
// Removing a program of a 1.0 installation (its log has no SHA-256) never promises to keep a changed file.
var hashed = ServerLog(directory);
hashed.FormatVersion = 2;
hashed.Components = ["Chronos", "Uploader"];
hashed.Hashes["Chronos.Uploader.exe"] = new string('2', 64);
foreach (var (log, key) in new[] { (hashed, "Tooltips.Setup.Changes.Remove"), (ServerLog(directory), "Tooltips.Setup.Changes.RemoveUnchecked") })
{
log.Components = ["Chronos", "Uploader"];
using var removal = SetupViewModel.ForInstall(new SetupArguments(), payload, InstallPlan.Resolve(manifest, new SetupArguments(), existing, log, null));
Assert.Contains(removal.Components, c => c.Id == "Uploader").IsSelected = false;
Assert.Count(1, removal.Changes);
Assert.Equal(Loc.L(key), removal.Changes[0].ToolTip);
}
// A new installation with nothing ticked cannot start, and is no uninstall.
@@ -188,6 +188,15 @@ public sealed class UploaderUpdatesTests(TestContext context)
Assert.Equal(UpdateState.Unknown, vm.State);
});
[Test]
public void APortableUploaderIsOfferedTheSetupTheZipHoldsNoUploader()
{
// The portable zip carries the desktop app alone: whatever the copy, the Uploader updates through the setup.
Assert.False(Host(new Feed(), context.CreateTempDirectory(), []).IsPortable);
using var vm = new UpdatesViewModel(Host(new Feed(), context.CreateTempDirectory(), []), new UploaderSettings(), () => { });
Assert.Equal(Loc.L("Tooltips.Uploader.Updates.ShowSetup"), vm.ShowSetupToolTip);
}
private UpdatesViewModel Notice(Feed feed, out List<string> revealed)
{
revealed = [];
@@ -197,7 +206,7 @@ public sealed class UploaderUpdatesTests(TestContext context)
private static UpdateHost Host(Feed feed, string downloadRoot, List<string> revealed)
{
var http = new HttpClient(feed, disposeHandler: false);
return UploaderUpdates.Host(http, http, Repository, "1.0.0", portable: false, downloadRoot, _ => { }, revealed.Add);
return UploaderUpdates.Host(http, http, Repository, "1.0.0", downloadRoot, _ => { }, revealed.Add);
}
private static async Task RunAsync(System.Windows.Input.ICommand command)
@@ -58,6 +58,25 @@ public sealed class WorkspaceHostTests(TestContext context)
}
}
[Test]
public void AProjectOpenInTheEditorIsHeldUntilItsSourceCloses()
{
var installed = AppEnvironment.From(AppPaths.Resolve(context.CreateTempDirectory("app"), context.CreateTempDirectory("local"), []));
var host = new WorkspaceHost(installed, new AppSettings(), () => { }, () => null, () => null, () => null);
var project = Guid.CreateVersion7();
Assert.False(host.HasProjectsInEditor);
// The same project in two editors, then each closing (one twice): held until the last one closes.
var first = host.HoldInEditor(project);
var second = host.HoldInEditor(project);
Assert.True(host.HasProjectsInEditor, "a server's home does not move under an open editor");
first.Dispose();
first.Dispose();
Assert.True(host.HasProjectsInEditor, "the second editor still has it");
second.Dispose();
Assert.False(host.HasProjectsInEditor);
}
[Test]
public void TheWorkspaceSettingsSurviveTheSettingsFile()
{
@@ -190,6 +190,11 @@ public sealed class HomeLayoutMigrationTests(TestContext context)
var homes = new WorkspaceHomes(legacy.Workspace);
Assert.Equal(homes.Root, Path.GetDirectoryName(Assert.NotNull(homes.Find(legacy.Local)).Folder));
Assert.Equal(4, homes.List().Count);
// A copy, render or send job of the project left in place still finds it: the parent opens as the view of what it holds.
var root = WorkspaceJobRoots.Resolve(legacy.Workspace, legacy.Local, null, "Errors.Workspace.NotCheckedOut");
Assert.Equal(WorkspaceStore.FullRoot(legacy.Workspace), root);
Assert.Throws<InvalidDataException>(() => new WorkspaceStore(root));
Assert.NotNull(WorkspaceStore.ForJob(root).Find(legacy.Local));
}
result = await legacy.Migration().ApplyAsync(context.Cancellation);
Assert.Equal((1, 0), (result.ProjectsMoved, result.InUse));
@@ -14,6 +14,9 @@ public sealed class JobContextProgressTests(TestContext context)
{
private static readonly TimeSpan Tick = TimeSpan.FromMilliseconds(10);
/// <summary>A quarter of the default publish interval: what a new step waits since the last publish.</summary>
private static readonly TimeSpan StepWait = TimeSpan.FromMilliseconds(125);
[Test]
public async Task AHundredReportsInASecondGoOutAtMostThreeTimes()
{
@@ -24,8 +27,46 @@ public sealed class JobContextProgressTests(TestContext context)
run.Time.Advance(Tick);
}
Assert.True(run.Published.Count <= 3, $"{run.Published.Count} publishes");
// The first at once, then one per half second.
Assert.SequenceEqual([1L, 51L], run.Published.Select(p => p.Done));
// The first at once, then one per half second: the latest state when its time comes.
Assert.SequenceEqual([1L, 50L, 100L], run.Published.Select(p => p.Done));
}
[Test]
public async Task AJobGoneQuietInALongStepShowsItsLatestStateOnTime()
{
await using var run = await StartAsync();
// Maintenance: its first sub-steps take milliseconds, the third runs for minutes without a report.
await run.Context.ReportAsync(0, 5, new JobDetail(JobStep.Maintenance, "leases", 0, 0, 1, 5, JobPartUnit.Step));
run.Time.Advance(TimeSpan.FromMilliseconds(30));
await run.Context.CheckpointAsync("leases", 1, 5, new JobDetail(JobStep.Maintenance, "temp", 0, 0, 2, 5, JobPartUnit.Step));
run.Time.Advance(TimeSpan.FromMilliseconds(30));
var packs = new JobDetail(JobStep.Maintenance, "packs", 0, 0, 3, 5, JobPartUnit.Step);
await run.Context.CheckpointAsync("temp", 2, 5, packs);
Assert.Count(1, run.Published);
run.Time.Advance(TimeSpan.FromMilliseconds(500));
Assert.Count(2, run.Published);
Assert.Equal((2L, packs), (run.Published[^1].Done, run.Published[^1].Detail));
// Nothing new: nothing more goes out.
run.Time.Advance(TimeSpan.FromSeconds(10));
Assert.Count(2, run.Published);
}
[Test]
public async Task AJobThatAlternatesStepsGoesOutAFewTimesASecond()
{
await using var run = await StartAsync();
// An incremental scan: every other folder changed, checked and indexed in turn, 200 reports in a second.
for (var i = 0; i < 200; i++)
{
var step = i % 2 == 0 ? JobStep.Check : JobStep.Index;
await run.Context.ReportAsync(i, 10_000, new JobDetail(step, "folder " + i, 0, 0, i + 1, 10_000, JobPartUnit.Folder));
run.Time.Advance(TimeSpan.FromMilliseconds(5));
}
Assert.True(run.Published.Count <= 10, $"{run.Published.Count} publishes");
// The last report still goes out once its time comes.
run.Time.Advance(TimeSpan.FromSeconds(1));
Assert.Equal(199L, run.Published[^1].Done);
}
[Test]
@@ -36,7 +77,8 @@ public sealed class JobContextProgressTests(TestContext context)
await run.Context.ReportAsync(1, 10, new JobDetail(JobStep.List));
run.Time.Advance(Tick);
await run.Context.ReportAsync(2, 10, new JobDetail(JobStep.List));
run.Time.Advance(Tick);
// A new step goes out once a quarter of the interval has passed, not at every switch.
run.Time.Advance(StepWait);
await run.Context.ReportAsync(3, 10, index);
run.Time.Advance(Tick);
await run.Context.ReportItemAsync(4, 10, 2, 5);
@@ -91,7 +133,7 @@ public sealed class JobContextProgressTests(TestContext context)
Assert.Equal(published, run.Published.Count);
var verify = new JobDetail(JobStep.Verify, "Harbour sunset", 1, 9, 1, 3, JobPartUnit.Sequence);
run.Time.Advance(Tick);
run.Time.Advance(StepWait);
await run.Context.CheckpointAsync("53", 53, 100, verify);
stored = await run.StoredAsync();
Assert.Equal((53L, "53", verify), (stored.ProgressDone, stored.Checkpoint, stored.Detail));
@@ -5,16 +5,71 @@ using Chronos.Testing;
namespace Chronos.Data.Tests.Jobs;
/// <summary>A clock the test moves by hand (BCL <see cref="TimeProvider"/>, no package).</summary>
/// <summary>
/// A clock the test moves by hand (BCL <see cref="TimeProvider"/>, no package), whose timers fire only when
/// <see cref="Advance"/> reaches them, on the test's thread.
/// </summary>
internal sealed class ManualTime : TimeProvider
{
private readonly Lock _gate = new();
private readonly List<Timer> _timers = [];
private long _ticks;
public override long TimestampFrequency => TimeSpan.TicksPerSecond;
public override long GetTimestamp() => Interlocked.Read(ref _ticks);
public void Advance(TimeSpan by) => Interlocked.Add(ref _ticks, by.Ticks);
public override ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
{
var timer = new Timer(this, callback, state);
timer.Change(dueTime, period);
return timer;
}
/// <summary>Moves the clock on, then fires each one-shot timer due by then.</summary>
public void Advance(TimeSpan by)
{
List<Timer> due;
lock (_gate)
{
var now = Interlocked.Add(ref _ticks, by.Ticks);
due = [.. _timers.Where(t => t.Due <= now)];
foreach (var timer in due) _timers.Remove(timer);
}
foreach (var timer in due) timer.Fire();
}
private void Schedule(Timer timer, TimeSpan dueTime)
{
lock (_gate)
{
_timers.Remove(timer);
if (dueTime == Timeout.InfiniteTimeSpan) return;
timer.Due = Interlocked.Read(ref _ticks) + dueTime.Ticks;
_timers.Add(timer);
}
}
private sealed class Timer(ManualTime clock, TimerCallback callback, object? state) : ITimer
{
public long Due { get; set; }
public bool Change(TimeSpan dueTime, TimeSpan period)
{
clock.Schedule(this, dueTime);
return true;
}
public void Fire() => callback(state);
public void Dispose() => clock.Schedule(this, Timeout.InfiniteTimeSpan);
public ValueTask DisposeAsync()
{
Dispose();
return ValueTask.CompletedTask;
}
}
}
[Category("jobs")]
@@ -1,6 +1,9 @@
using Chronos.Core.IO;
using Chronos.Data.Homes;
using Chronos.Data.Sync;
using Chronos.Data.Tests.Infrastructure;
using Chronos.Data.Tests.Repositories;
using Chronos.Data.Workspaces;
using Chronos.Testing;
namespace Chronos.Data.Tests.Sync;
@@ -59,6 +62,33 @@ public abstract class SyncLinkRekeyTests(TestContext context) : RepositoryTest(c
Assert.Equal((0, 0), await store.RekeyAsync(Address, IdKey, Ct));
Assert.Equal((0, 0), await store.RekeyAsync(IdKey, IdKey, Ct));
}
[Test]
public async Task TheLinksMoveToTheIdWhileTheFoldersWait()
{
var db = await OpenChronosAsync();
var archive = TestData.Archive();
await db.Archives.UpsertAsync(archive, Ct);
var sequence = TestData.Sequence(archive.Id);
await db.Sequences.UpsertAsync(sequence, Ct);
var store = new SyncLinkStore(db);
var remote = Guid.CreateVersion7();
await store.UpsertAsync(Link(Address, remote, sequence.Id, TestData.Now), Ct);
var data = Context.CreateTempDirectory("data");
var workspace = new WorkspaceHomes(Path.Combine(data, "workspace"));
var home = Path.Combine(workspace.Root, "servers", HomeFolders.ServerFolder(Address));
Directory.CreateDirectory(home);
var migration = new HomeLayoutMigration(new HomeLayoutOptions { DataDirectory = data, WorkspaceRoot = workspace.Root, Database = db });
// A download or an upload resumed under the id key finds its link before the folders move (a job held them).
var id = ServerIdentity.IdOf(IdKey)!.Value;
Assert.Equal((1, 0), await migration.RekeyLinksAsync(id, [Address, IdKey], Ct));
Assert.Equal(sequence.Id, Assert.NotNull(await store.GetAsync(IdKey, remote, Ct)).LocalId);
Assert.Equal(sequence.Id, Assert.NotNull(await store.FindByLocalAsync(IdKey, sequence.Id, Ct)).LocalId);
Assert.Empty(await store.ListAsync(Address, Ct));
Assert.True(Directory.Exists(home), "the folders wait for the full re-key");
Assert.Equal((0, 0), await migration.RekeyLinksAsync(id, [Address], Ct));
}
}
public sealed class SqliteSyncLinkRekeyTests(TestContext context) : SyncLinkRekeyTests(context)
@@ -90,6 +90,23 @@ public sealed class ProgressEventTests(TestContext context)
Assert.Equal(TimeSpan.FromMilliseconds(500), ProgressGate.Interval);
}
[Test]
public void AJobThatAlternatesStepsStillGoesOutAFewTimesASecond()
{
var clock = new TimestampClock();
var gate = new ProgressGate(clock);
var job = Guid.CreateVersion7();
// An incremental scan: every other folder changed, checked and indexed in turn, 200 reports in a second.
var passed = 0;
for (var i = 0; i < 200; i++)
{
if (gate.Passes(job, i, 10_000, i % 2 == 0 ? JobStep.Check : JobStep.Index)) passed++;
clock.Advance(TimeSpan.FromMilliseconds(5));
}
Assert.True(passed <= 14, $"{passed} passed");
Assert.True(passed >= 4, $"{passed} passed: a new step still goes out early");
}
[Test]
public async Task TheServerSendsAndSavesWhatItsJobsDo()
{
@@ -117,6 +117,60 @@ public sealed class HostedServerTests(TestContext context)
using (var get = await admin.GetAsync($"/api/v1/jobs/{workspace.Id}")) Assert.Equal(HttpStatusCode.NotFound, get.StatusCode);
using (var cancel = await admin.PostAsync($"/api/v1/jobs/{workspace.Id}/cancel", null)) Assert.Equal(HttpStatusCode.NotFound, cancel.StatusCode);
Assert.Equal(JobState.Queued, (await desktop.Database.Jobs.GetAsync(workspace.Id))!.State);
// The events say nothing of the desktop's own jobs, nor of its work on its other archive; the shared archive's go out.
using var events = shared.Events.Subscribe();
await desktop.Engine.CancelAsync(workspace.Id);
var elsewhere = await desktop.Engine.EnqueueAsync(JobKind.Thumbs, [theirs.Id], "theirs");
await desktop.WaitAsync(elsewhere.Id);
var served = await desktop.Engine.EnqueueAsync(JobKind.Thumbs, [mine.Id], "mine");
var finished = JobWire.State((await desktop.WaitAsync(served.Id)).State);
var seen = new List<ServerEvent>();
using (var wait = CancellationTokenSource.CreateLinkedTokenSource(context.Cancellation))
{
wait.CancelAfter(TimeSpan.FromSeconds(30));
while (await events.Reader.ReadAsync(wait.Token) is var e)
{
seen.Add(e);
if (e is JobStateEvent { State: var state } done && done.JobId == served.Id && state == finished) break;
}
}
Assert.Contains(seen, e => e is JobStateEvent s && s.JobId == served.Id);
Assert.False(seen.Any(e => e is JobStateEvent s && (s.JobId == workspace.Id || s.JobId == elsewhere.Id)), "a private job's state went out");
Assert.False(seen.Any(e => e is JobProgressEvent p && (p.JobId == workspace.Id || p.JobId == elsewhere.Id)), "a private job's progress went out");
Assert.False(seen.Any(e => e is SequenceChangedEvent c && c.SequenceId == theirs.Id), "another archive's sequence went out");
var all = Assert.NotNull(await admin.GetFromJsonAsync("/api/v1/jobs", ProtocolJson.Default.PageJobDto));
Assert.False(all.Items.Any(j => j.Id == elsewhere.Id), "a job on the desktop's other archive is listed");
Assert.True(all.Items.Any(j => j.Id == served.Id), "the shared archive's job is listed");
using (var get = await admin.GetAsync($"/api/v1/jobs/{elsewhere.Id}")) Assert.Equal(HttpStatusCode.NotFound, get.StatusCode);
}
[Test]
public async Task RenderNodesTakeOnlyTheRendersClientsQueuedOnTheSharedArchive()
{
await using var desktop = await DesktopFixture.StartAsync(context);
var mine = await desktop.SequenceAsync(desktop.Archive);
var other = await desktop.Archives.CreateAsync(context.CreateTempDirectory("other"), "Another archive", cancellationToken: context.Cancellation);
var theirs = await desktop.SequenceAsync(other);
await using var shared = await desktop.ShareAsync();
using var admin = await desktop.AdminAsync(shared);
var hevc = Jobs.RenderNodeTests.HevcJob;
// Older and as urgent as the client's: the desktop's own render (its export goes where its user chose), and one of
// a sequence of the desktop's other archive.
await desktop.Engine.EnqueueAsync(JobKind.Render, [mine.Id], "desktop", hevc, JobPriority.User);
await desktop.Engine.EnqueueAsync(JobKind.Render, [theirs.Id], "elsewhere", hevc, JobPriority.User, Guid.CreateVersion7());
using var created = await admin.PostAsJsonAsync("/api/v1/jobs", new CreateJobRequest("render", [mine.Id], hevc), ProtocolJson.Default.CreateJobRequest);
Assert.Equal(HttpStatusCode.Accepted, created.StatusCode);
var client = Assert.NotNull(await created.Content.ReadFromJsonAsync(ProtocolJson.Default.JobDto));
var node = await Jobs.RenderNodeTests.RegisterAsync(admin, "studio-node", "hevc", 8192);
using (var claim = await admin.PostAsync($"/api/v1/nodes/{node.Id}/claim", null))
{
Assert.Equal(HttpStatusCode.OK, claim.StatusCode);
var claimed = Assert.NotNull(await claim.Content.ReadFromJsonAsync(ProtocolJson.Default.ClaimedJob));
Assert.Equal(client.Id, claimed.Job.Id);
}
using (var none = await admin.PostAsync($"/api/v1/nodes/{node.Id}/claim", null)) Assert.Equal(HttpStatusCode.NoContent, none.StatusCode);
}
[Test]
@@ -36,6 +36,22 @@ public sealed class PackInstallerCommandTests(TestContext context)
Assert.Equal("Chronos", association.Component);
}
[Test]
public async Task ASetupOfTheUploaderAloneHasItPreselectedAsThe10SetupDid()
{
var root = context.CreateTempDirectory("pack");
var stub = await Stub(root);
var uploader = Program(root, "uploader", "Chronos.Uploader.exe");
var output = Path.Combine(root, "out", "Chronos-Uploader-Setup.exe");
Assert.Equal(0, await new PackInstallerCommand().RunAsync(
["--setup", stub, "--product", "Chronos Uploader", "--version", "1.0.0", "--component", "Uploader=" + uploader, "--out", output]));
using var reader = PayloadReader.Open(output);
// A silent run without /COMPONENTS installs it, as the separate 1.0 setup did.
Assert.True(reader.Manifest.FindComponent("Uploader")!.DefaultSelected);
}
[Test]
public async Task TheServerIsPackedOnlyForTheMigrationTest()
{