feat: single setup, mass-pass progress, per-server homes, Desktop shares its library (owner review 5, v1.1.0) (#68)
CI / Build and test (push) Successful in 11m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 12s
Release / Build, test and publish (push) Successful in 14m56s
CI / PostgreSQL 16 integration (push) Successful in 10m11s
CI / PostgreSQL 17 integration (push) Successful in 10m15s
CI / Docker image (push) Successful in 45s
Release / Server image (push) Successful in 4m55s
CI / Build and test (push) Successful in 11m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 12s
Release / Build, test and publish (push) Successful in 14m56s
CI / PostgreSQL 16 integration (push) Successful in 10m11s
CI / PostgreSQL 17 integration (push) Successful in 10m15s
CI / Docker image (push) Successful in 45s
Release / Server image (push) Successful in 4m55s
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #68.
This commit is contained in:
1 parent
988068ee8e
commit
20d64af4a4
793 files changed
+23882
-2096
No files matched your search
@@ -30,12 +30,52 @@ public abstract class JobRepositoryTests(TestContext context) : RepositoryTest(c
|
||||
Started = TestData.Now.AddMinutes(1),
|
||||
Finished = TestData.Now.AddMinutes(2),
|
||||
ScheduleId = Guid.CreateVersion7(),
|
||||
Detail = new JobDetail(JobStep.Encode, "Harbour sunset", 5, 10, 1, 2, JobPartUnit.Render),
|
||||
};
|
||||
await db.Jobs.EnqueueAsync(job, Ct);
|
||||
var read = Assert.NotNull(await db.Jobs.GetAsync(job.Id, Ct));
|
||||
Assert.SequenceEqual(job.TargetIds, read.TargetIds);
|
||||
Assert.Equal(job with { TargetIds = read.TargetIds }, read);
|
||||
Assert.Null((await db.Jobs.GetAsync((await EnqueueAsync(db, TestData.Job())).Id, Ct))!.ScheduleId);
|
||||
var plain = (await db.Jobs.GetAsync((await EnqueueAsync(db, TestData.Job())).Id, Ct))!;
|
||||
Assert.Null(plain.ScheduleId);
|
||||
Assert.Null(plain.Detail);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheProgressDetailIsSavedWithTheProgressAndListedWithTheJob()
|
||||
{
|
||||
var db = await OpenChronosAsync();
|
||||
var job = TestData.Job(JobKind.Verify);
|
||||
await db.Jobs.EnqueueAsync(job, Ct);
|
||||
await db.Jobs.ClaimNextAsync("w", cancellationToken: Ct);
|
||||
var detail = new JobDetail(JobStep.Verify, "Harbour sunset · 2024", 812, 2400, 3, 41, JobPartUnit.Sequence);
|
||||
Assert.True(await db.Jobs.UpdateProgressAsync(job.Id, 4, 10, null, null, "cursor:4", null, detail, Ct));
|
||||
Assert.Equal(detail, (await db.Jobs.GetAsync(job.Id, Ct))!.Detail);
|
||||
// Lists read it too: a paused job tells where it stopped.
|
||||
Assert.SequenceEqual([detail], (await db.Jobs.ListBriefAsync(JobState.Running, null, cancellationToken: Ct)).Items.Select(j => j.Detail));
|
||||
|
||||
// Without a detail the column is cleared; a node's progress keeps or replaces it.
|
||||
Assert.True(await db.Jobs.UpdateProgressAsync(job.Id, 5, 10, null, null, "cursor:5", null, Ct));
|
||||
Assert.Null((await db.Jobs.GetAsync(job.Id, Ct))!.Detail);
|
||||
var node = new JobDetail(JobStep.Encode, null, 120, 3600);
|
||||
Assert.True(await db.Jobs.UpdateNodeProgressAsync(job.Id, "w", 6, 10, null, null, null, node, Ct));
|
||||
Assert.True(await db.Jobs.UpdateNodeProgressAsync(job.Id, "w", 7, 10, null, null, "line", Ct));
|
||||
Assert.Equal(node, (await db.Jobs.GetAsync(job.Id, Ct))!.Detail);
|
||||
Assert.True(await db.Jobs.UpdateNodeProgressAsync(job.Id, "w", 8, 10, null, null, null, null, Ct));
|
||||
Assert.Null((await db.Jobs.GetAsync(job.Id, Ct))!.Detail);
|
||||
|
||||
// A cell this build cannot read is no detail, never an error.
|
||||
foreach (var unreadable in new[] { "not json", "42", "[]", "{\"step\": 7}" })
|
||||
{
|
||||
await using (var session = await db.Database.OpenAsync(Ct))
|
||||
await session.ExecuteAsync("UPDATE jobs SET progress_detail = $1 WHERE id = $2", [unreadable, job.Id], Ct);
|
||||
Assert.Null((await db.Jobs.GetAsync(job.Id, Ct))!.Detail);
|
||||
}
|
||||
// One of a newer build: its step and unit read as none, the counts stay.
|
||||
await using (var session = await db.Database.OpenAsync(Ct))
|
||||
await session.ExecuteAsync("UPDATE jobs SET progress_detail = $1 WHERE id = $2",
|
||||
["""{"step":"teleport","itemDone":3,"itemTotal":9,"part":2,"parts":4,"partUnit":"galaxy","future":true}""", job.Id], Ct);
|
||||
Assert.Equal(new JobDetail(JobStep.None, null, 3, 9, 2, 4), (await db.Jobs.GetAsync(job.Id, Ct))!.Detail);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user