refactor!: rename Titano to Chronos and move CI and releases to Gitea
CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
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. 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) and pe-check. 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>
This commit is contained in:
1 parent
c99842cc86
commit
5f27a86406
1799 files changed
+11728
-10668
No files matched your search
@@ -0,0 +1,143 @@
|
||||
using System.IO;
|
||||
using Chronos.Testing;
|
||||
using Chronos.Uploader.Uploads;
|
||||
|
||||
namespace Chronos.App.Tests.Uploader;
|
||||
|
||||
public sealed class UploadQueueTests(TestContext context)
|
||||
{
|
||||
private static readonly DateTime Now = new(2026, 9, 28, 18, 30, 0, DateTimeKind.Utc);
|
||||
|
||||
[Test]
|
||||
public void PersistenceRoundTripKeepsBatchesItemsAndStates()
|
||||
{
|
||||
var queue = new UploadQueue();
|
||||
var sessions = new UploadBatch { Id = Guid.CreateVersion7(), Mode = UploadTargetMode.Sessions };
|
||||
var created = new UploadBatch { Id = Guid.CreateVersion7(), Mode = UploadTargetMode.NewSequence, Title = "Harbour sunset", SequenceId = Guid.CreateVersion7() };
|
||||
queue.Add(sessions, [Entry("a.cr2", "k1", @"D:\Cam\Roof"), Entry("b.cr2", "k1", null)]);
|
||||
queue.Add(created, [Entry("c.jpg", null, null)]);
|
||||
var verified = queue.Items[0];
|
||||
verified.State = UploadItemState.Verified;
|
||||
verified.Sha256 = new string('a', 64);
|
||||
verified.FrameId = Guid.CreateVersion7();
|
||||
var failed = queue.Items[1];
|
||||
failed.Retries = 2;
|
||||
queue.Fail(failed, UploadFailure.ServerRejected, "quota exceeded", Now);
|
||||
queue.IsPaused = true;
|
||||
|
||||
var path = Path.Combine(context.CreateTempDirectory(), "uploader-queue.json");
|
||||
File.WriteAllBytes(path, QueueStore.Serialize(queue));
|
||||
var restored = new UploadQueue();
|
||||
QueueStore.Load(path, restored);
|
||||
|
||||
Assert.True(restored.IsPaused);
|
||||
Assert.Equal(2, restored.Batches.Count);
|
||||
Assert.Equal("Harbour sunset", restored.GetBatch(created.Id)!.Title);
|
||||
Assert.Equal(created.SequenceId, restored.GetBatch(created.Id)!.SequenceId);
|
||||
Assert.Equal(3, restored.Items.Count);
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
var (a, b) = (queue.Items[i], restored.Items[i]);
|
||||
Assert.Equal(a.Id, b.Id);
|
||||
Assert.Equal(a.BatchId, b.BatchId);
|
||||
Assert.Equal(a.Path, b.Path);
|
||||
Assert.Equal(a.Size, b.Size);
|
||||
Assert.Equal(a.ModifiedUtc, b.ModifiedUtc);
|
||||
Assert.Equal(a.CapturedAt, b.CapturedAt);
|
||||
Assert.Equal(a.SessionKey, b.SessionKey);
|
||||
Assert.Equal(a.WatchRoot, b.WatchRoot);
|
||||
Assert.Equal(a.State, b.State);
|
||||
}
|
||||
Assert.Equal(verified.Sha256, restored.Items[0].Sha256);
|
||||
Assert.Equal(verified.FrameId, restored.Items[0].FrameId);
|
||||
Assert.Equal(UploadFailure.ServerRejected, restored.Items[1].Failure);
|
||||
Assert.Equal("quota exceeded", restored.Items[1].FailureDetail);
|
||||
Assert.Equal(2, restored.Items[1].Retries);
|
||||
Assert.Equal(Now + UploadQueue.RetryDelay, restored.Items[1].NextRetryUtc);
|
||||
Assert.True(restored.ContainsPath("c.jpg"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InterruptedTransfersResumeAsQueued()
|
||||
{
|
||||
var queue = new UploadQueue();
|
||||
queue.Add(new UploadBatch { Id = Guid.CreateVersion7(), Mode = UploadTargetMode.Sessions }, [Entry("a.cr2", null, null), Entry("b.cr2", null, null)]);
|
||||
queue.Items[0].State = UploadItemState.Uploading;
|
||||
queue.Items[0].Sha256 = new string('b', 64);
|
||||
queue.Items[1].State = UploadItemState.Hashing;
|
||||
|
||||
var path = Path.Combine(context.CreateTempDirectory(), "q.json");
|
||||
File.WriteAllBytes(path, QueueStore.Serialize(queue));
|
||||
var restored = new UploadQueue();
|
||||
QueueStore.Load(path, restored);
|
||||
|
||||
Assert.Equal(UploadItemState.Queued, restored.Items[0].State);
|
||||
Assert.Equal(UploadItemState.Queued, restored.Items[1].State);
|
||||
// The known hash is kept: the server resumes from the chunks it already holds.
|
||||
Assert.Equal(new string('b', 64), restored.Items[0].Sha256);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CorruptOrMissingFileGivesAnEmptyQueue()
|
||||
{
|
||||
var dir = context.CreateTempDirectory();
|
||||
var corrupt = Path.Combine(dir, "q.json");
|
||||
File.WriteAllText(corrupt, "{ not json");
|
||||
var queue = new UploadQueue();
|
||||
QueueStore.Load(corrupt, queue);
|
||||
QueueStore.Load(Path.Combine(dir, "missing.json"), queue);
|
||||
Assert.Empty(queue.Items);
|
||||
Assert.False(queue.IsPaused);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddingSkipsPathsAlreadyQueued()
|
||||
{
|
||||
var queue = new UploadQueue();
|
||||
var batch = new UploadBatch { Id = Guid.CreateVersion7(), Mode = UploadTargetMode.Sessions };
|
||||
Assert.Equal(2, queue.Add(batch, [Entry("a.jpg", null, null), Entry("b.jpg", null, null)]));
|
||||
Assert.Equal(1, queue.Add(batch, [Entry("b.jpg", null, null), Entry("c.jpg", null, null)]));
|
||||
Assert.Equal(3, queue.Items.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FailedItemsComeBackAfterTheDelayUntilRetriesRunOut()
|
||||
{
|
||||
var queue = new UploadQueue();
|
||||
queue.Add(new UploadBatch { Id = Guid.CreateVersion7(), Mode = UploadTargetMode.Sessions }, [Entry("a.jpg", null, null)]);
|
||||
var item = queue.Items[0];
|
||||
item.State = UploadItemState.Hashing;
|
||||
queue.Fail(item, UploadFailure.FileUnreadable, null, Now);
|
||||
Assert.Null(queue.NextReady(Now.AddSeconds(29)));
|
||||
Assert.Same(item, queue.NextReady(Now + UploadQueue.RetryDelay));
|
||||
Assert.True(queue.HasPending);
|
||||
|
||||
item.Retries = UploadQueue.MaxRetries;
|
||||
queue.Fail(item, UploadFailure.FileUnreadable, null, Now);
|
||||
Assert.Null(item.NextRetryUtc);
|
||||
Assert.Null(queue.NextReady(Now.AddDays(1)));
|
||||
Assert.False(queue.HasPending);
|
||||
|
||||
queue.Requeue(item);
|
||||
Assert.Equal(0, item.Retries);
|
||||
Assert.Same(item, queue.NextReady(Now));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemovingCompletedItemsKeepsTheRest()
|
||||
{
|
||||
var queue = new UploadQueue();
|
||||
var batch = new UploadBatch { Id = Guid.CreateVersion7(), Mode = UploadTargetMode.Sessions };
|
||||
queue.Add(batch, [Entry("a.jpg", null, null), Entry("b.jpg", null, null), Entry("c.jpg", null, null)]);
|
||||
queue.Items[0].State = UploadItemState.Verified;
|
||||
queue.Items[2].State = UploadItemState.Skipped;
|
||||
queue.RemoveCompleted();
|
||||
Assert.Equal(1, queue.Items.Count);
|
||||
Assert.False(queue.ContainsPath("a.jpg"));
|
||||
Assert.True(queue.ContainsPath("b.jpg"));
|
||||
Assert.Equal(1, queue.Batches.Count);
|
||||
}
|
||||
|
||||
private static QueueEntry Entry(string name, string? session, string? watchRoot) =>
|
||||
new(name, 1_000 + name.Length, new DateTime(2026, 9, 28, 16, 2, 11, DateTimeKind.Utc), new DateTime(2026, 9, 28, 18, 2, 11), session, watchRoot);
|
||||
}
|
||||
Reference in new issue
Block a user