CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
153 lines
6.7 KiB
C#
153 lines
6.7 KiB
C#
using Chronos.App.Jobs;
|
||
using Chronos.Core.Model;
|
||
using Chronos.Testing;
|
||
|
||
namespace Chronos.App.Tests.Jobs;
|
||
|
||
/// <summary>UI-08: which job endings raise the shell's toast, whichever screen started the job, and how a batch speaks once.</summary>
|
||
public sealed class JobNoticesTests
|
||
{
|
||
[Theory]
|
||
[Case(JobKind.Render)]
|
||
[Case(JobKind.DeepAnalyse)]
|
||
[Case(JobKind.Verify)]
|
||
[Case(JobKind.Rebuild)]
|
||
[Case(JobKind.Maintenance)]
|
||
[Case(JobKind.UploadCommit)]
|
||
[Case(JobKind.Move)]
|
||
[Case(JobKind.Adopt)]
|
||
public void ALongOperationThatEndsSaysSo(JobKind kind)
|
||
{
|
||
Assert.Equal(JobNotice.Done, JobNotices.For(JobState.Running, Job(kind, JobState.Done)));
|
||
Assert.Equal(JobNotice.Failed, JobNotices.For(JobState.Running, Job(kind, JobState.Failed)));
|
||
// Queued and finished between two flushes of the Jobs screen: still one notice.
|
||
Assert.Equal(JobNotice.Done, JobNotices.For(JobState.Queued, Job(kind, JobState.Done)));
|
||
Assert.Equal(JobNotice.Done, JobNotices.For(null, Job(kind, JobState.Done)));
|
||
}
|
||
|
||
[Theory]
|
||
[Case(JobKind.Scan)]
|
||
[Case(JobKind.LightAnalyse)]
|
||
[Case(JobKind.Thumbs)]
|
||
[Case(JobKind.Proxies)]
|
||
public void UpkeepAndScansEndSilently(JobKind kind)
|
||
{
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Running, Job(kind, JobState.Done)));
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Running, Job(kind, JobState.Failed)));
|
||
}
|
||
|
||
[Theory]
|
||
[Case(JobKind.Import)]
|
||
[Case(JobKind.Download)]
|
||
[Case(JobKind.Duplicates)]
|
||
[Case(JobKind.Orphans)]
|
||
public void EveryOtherFailureIsSaid(JobKind kind)
|
||
{
|
||
// An import announces its result on the Import screen, a download on its Library card and Server row.
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Running, Job(kind, JobState.Done)));
|
||
Assert.Equal(JobNotice.Failed, JobNotices.For(JobState.Running, Job(kind, JobState.Failed)));
|
||
}
|
||
|
||
[Test]
|
||
public void BackgroundPriorityCancelledAndRepeatedEndingsSayNothing()
|
||
{
|
||
// The deep analysis queued after an import, and the proxies sync fetches, run in the background.
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Running, Job(JobKind.DeepAnalyse, JobState.Done, JobPriority.Background)));
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Running, Job(JobKind.Download, JobState.Failed, JobPriority.Background)));
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Running, Job(JobKind.Render, JobState.Cancelled)));
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Done, Job(JobKind.Render, JobState.Done)));
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Failed, Job(JobKind.Render, JobState.Failed)));
|
||
Assert.Equal(JobNotice.None, JobNotices.For(JobState.Queued, Job(JobKind.Render, JobState.Running)));
|
||
// "Add to queue" renders have Normal priority: they are announced too.
|
||
Assert.Equal(JobNotice.Done, JobNotices.For(JobState.Running, Job(JobKind.Render, JobState.Done, JobPriority.Normal)));
|
||
}
|
||
|
||
[Test]
|
||
public void ABatchOfOneKindSpeaksOnceWhenItsLastJobEnds()
|
||
{
|
||
// Server › Upload all: 100 uploads queued; each one that ends waits for the rest.
|
||
var endings = new JobEndings();
|
||
var model = new JobListModel();
|
||
var uploads = Enumerable.Range(0, 100).Select(_ => Job(JobKind.UploadCommit, JobState.Queued)).ToList();
|
||
foreach (var upload in uploads) model.Apply(upload);
|
||
for (var i = 0; i < 99; i++)
|
||
{
|
||
var done = uploads[i] with { State = JobState.Done };
|
||
model.Apply(done);
|
||
endings.Add(JobNotices.For(JobState.Running, done), done);
|
||
Assert.Empty(endings.Take(model.IsBusy));
|
||
}
|
||
Assert.Equal(99, endings.Waiting);
|
||
|
||
// A render of the same flush is its own kind: it is said at once.
|
||
var render = Job(JobKind.Render, JobState.Done);
|
||
model.Apply(render);
|
||
endings.Add(JobNotice.Done, render);
|
||
var due = endings.Take(model.IsBusy);
|
||
Assert.Count(1, due);
|
||
Assert.Equal(JobNotice.Done, due[0].Notice);
|
||
Assert.SequenceEqual([render.Id], due[0].Jobs.Select(j => j.Id));
|
||
|
||
var last = uploads[99] with { State = JobState.Done };
|
||
model.Apply(last);
|
||
endings.Add(JobNotice.Done, last);
|
||
due = endings.Take(model.IsBusy);
|
||
Assert.Count(1, due);
|
||
Assert.SequenceEqual(uploads.Select(u => u.Id), due[0].Jobs.Select(j => j.Id));
|
||
Assert.Equal(0, endings.Waiting);
|
||
Assert.Empty(endings.Take(model.IsBusy));
|
||
}
|
||
|
||
[Test]
|
||
public void PausedAndBackgroundJobsDoNotHoldABatch()
|
||
{
|
||
var endings = new JobEndings();
|
||
var model = new JobListModel();
|
||
// An upload paused on a metered network, and the proxies sync fetches in the background, wait for something else.
|
||
model.Apply(Job(JobKind.UploadCommit, JobState.Paused));
|
||
model.Apply(Job(JobKind.Download, JobState.Running, JobPriority.Background));
|
||
var upload = Job(JobKind.UploadCommit, JobState.Done);
|
||
model.Apply(upload);
|
||
endings.Add(JobNotice.Done, upload);
|
||
Assert.Count(1, endings.Take(model.IsBusy));
|
||
Assert.False(model.IsBusy(JobKind.UploadCommit));
|
||
Assert.False(model.IsBusy(JobKind.Download));
|
||
}
|
||
|
||
[Test]
|
||
public void FailuresAreSaidAtTheEndOfTheirFlushTogether()
|
||
{
|
||
var endings = new JobEndings();
|
||
var model = new JobListModel();
|
||
// More uploads still run: failures do not wait for them.
|
||
model.Apply(Job(JobKind.UploadCommit, JobState.Running));
|
||
var first = Job(JobKind.UploadCommit, JobState.Failed);
|
||
var second = Job(JobKind.Verify, JobState.Failed);
|
||
endings.Add(JobNotice.Failed, first);
|
||
endings.Add(JobNotice.Failed, second);
|
||
endings.Add(JobNotice.None, Job(JobKind.Scan, JobState.Done));
|
||
var due = endings.Take(model.IsBusy);
|
||
Assert.Count(1, due);
|
||
Assert.Equal(JobNotice.Failed, due[0].Notice);
|
||
Assert.SequenceEqual([first.Id, second.Id], due[0].Jobs.Select(j => j.Id));
|
||
|
||
// The next flush starts again.
|
||
var third = Job(JobKind.UploadCommit, JobState.Failed);
|
||
endings.Add(JobNotice.Failed, third);
|
||
due = endings.Take(model.IsBusy);
|
||
Assert.Count(1, due);
|
||
Assert.SequenceEqual([third.Id], due[0].Jobs.Select(j => j.Id));
|
||
Assert.Empty(endings.Take(model.IsBusy));
|
||
}
|
||
|
||
private static Job Job(JobKind kind, JobState state, JobPriority priority = JobPriority.User) => new()
|
||
{
|
||
Id = Guid.CreateVersion7(),
|
||
Kind = kind,
|
||
State = state,
|
||
Priority = priority,
|
||
TargetLabel = "Harbour sunset",
|
||
Created = DateTimeOffset.UtcNow,
|
||
};
|
||
}
|