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>
94 lines
3.9 KiB
C#
94 lines
3.9 KiB
C#
using Chronos.App.Settings;
|
||
using Chronos.Testing;
|
||
|
||
namespace Chronos.App.Tests.Settings;
|
||
|
||
/// <summary>
|
||
/// Settings › Archive never shows a read of the archive's settings that overlapped an edit being written: on a slow share
|
||
/// that read can hold archive.json as it was before the edit, and would undo the edit on the rows and in this PC's
|
||
/// defaults while the archive keeps it. Its reader waits for the edits instead and reads again, so the read is done only
|
||
/// once the rows show what the archive holds.
|
||
/// </summary>
|
||
public sealed class ArchiveReadGateTests
|
||
{
|
||
[Test]
|
||
public void AReadWithNoEditMeanwhileIsShown()
|
||
{
|
||
var gate = new ArchiveReadGate();
|
||
Assert.True(gate.IsCurrent(gate.BeginRead()));
|
||
Assert.True(gate.WrittenAsync().IsCompleted, "no edit is being written");
|
||
|
||
// An edit written and ended before the read began is in the file it reads.
|
||
gate.BeginWrite();
|
||
gate.EndWrite();
|
||
Assert.True(gate.IsCurrent(gate.BeginRead()));
|
||
Assert.True(gate.WrittenAsync().IsCompleted);
|
||
}
|
||
|
||
[Test]
|
||
public void AReadThatAnEditOverlapsWaitsForTheEditAndReadsAgain()
|
||
{
|
||
// Settings is shown and reads archive.json; the user commits a template before the read answers.
|
||
var gate = new ArchiveReadGate();
|
||
var read = gate.BeginRead();
|
||
gate.BeginWrite();
|
||
Assert.False(gate.IsCurrent(read), "the read may hold the file before the edit");
|
||
var written = gate.WrittenAsync();
|
||
Assert.False(written.IsCompleted, "the edit is still being written");
|
||
gate.EndWrite();
|
||
Assert.True(written.IsCompleted, "the reader reads again once the edit is written");
|
||
Assert.True(gate.IsCurrent(gate.BeginRead()));
|
||
|
||
// The edit began and ended while the read was out: the reader reads again at once.
|
||
read = gate.BeginRead();
|
||
gate.BeginWrite();
|
||
gate.EndWrite();
|
||
Assert.False(gate.IsCurrent(read));
|
||
Assert.True(gate.WrittenAsync().IsCompleted);
|
||
Assert.True(gate.IsCurrent(gate.BeginRead()));
|
||
}
|
||
|
||
[Test]
|
||
public void AReadBegunWhileAnEditIsWrittenIsNeverShown()
|
||
{
|
||
// The rows are read again (a folder change, the screen shown) while an edit is still being written.
|
||
var gate = new ArchiveReadGate();
|
||
gate.BeginWrite();
|
||
var read = gate.BeginRead();
|
||
Assert.False(gate.IsCurrent(read));
|
||
var written = gate.WrittenAsync();
|
||
gate.EndWrite();
|
||
Assert.False(gate.IsCurrent(read), "it began before the edit was written");
|
||
Assert.True(written.IsCompleted);
|
||
Assert.True(gate.IsCurrent(gate.BeginRead()));
|
||
}
|
||
|
||
[Test]
|
||
public async Task AReaderGoesOnOnlyOnceTheLastOfSeveralEditsIsWrittenAndNeverInsideIt()
|
||
{
|
||
// A proxy size and a thumbnail size picked one after the other, both overlapping a read.
|
||
var gate = new ArchiveReadGate();
|
||
var read = gate.BeginRead();
|
||
gate.BeginWrite();
|
||
gate.BeginWrite();
|
||
Assert.False(gate.IsCurrent(read));
|
||
var written = gate.WrittenAsync();
|
||
Assert.Same(written, gate.WrittenAsync());
|
||
gate.EndWrite();
|
||
Assert.False(written.IsCompleted, "another edit is still being written");
|
||
|
||
// The reader goes on once the last edit ends, never inside its EndWrite: the writer finishes first.
|
||
var thread = Environment.CurrentManagedThreadId;
|
||
var ending = false;
|
||
var inside = written.ContinueWith(_ => ending && Environment.CurrentManagedThreadId == thread, CancellationToken.None,
|
||
TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
|
||
ending = true;
|
||
gate.EndWrite();
|
||
ending = false;
|
||
Assert.True(written.IsCompleted);
|
||
Assert.False(await inside, "the reader did not go on inside EndWrite");
|
||
Assert.True(gate.IsCurrent(gate.BeginRead()));
|
||
Assert.Throws<InvalidOperationException>(() => gate.EndWrite());
|
||
}
|
||
}
|