CI / Build and test (push) Successful in 9m26s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 8s
Release / Build, test and publish (push) Successful in 14m31s
CI / PostgreSQL 16 integration (push) Successful in 9m53s
CI / PostgreSQL 17 integration (push) Successful in 9m22s
CI / Docker image (push) Successful in 44s
Release / Server image (push) Successful in 1m36s
Originals in the workspace, local render and send home with provenance, the workspace clean-up, size limit and trash, moving the workspace folder, and the complete Settings › Workspace page (owner review 2, R8, phase 5c). One adversarial review round (35 findings, 32 fixed), a copy-cancel race fixed, 184 strings in all 38 languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
64 lines
2.7 KiB
C#
64 lines
2.7 KiB
C#
using Chronos.App.Server;
|
|
using Chronos.Core.Model;
|
|
using Chronos.Data.Archiving.Jobs;
|
|
using Chronos.Data.Workspaces;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.App.Tests.Server;
|
|
|
|
/// <summary>
|
|
/// Which jobs "Pause metered transfers" holds (Server.html, phase 5c): uploads, the sync's downloads, and the workspace's copies from and renders
|
|
/// sent to a server; never a copy from or a send to this PC's archive.
|
|
/// </summary>
|
|
public sealed class UploadHoldTests
|
|
{
|
|
private const string Server = "https://nas.local:8443";
|
|
private static readonly Guid SequenceId = Guid.CreateVersion7();
|
|
private static readonly Guid ProjectId = Guid.CreateVersion7();
|
|
private const string Root = @"C:\Users\me\Chronos\workspace";
|
|
|
|
private static Job Of(ArchiveJobRequest request) => new()
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
Kind = request.Kind,
|
|
TargetIds = request.Targets,
|
|
TargetLabel = request.Label,
|
|
ParametersJson = request.ParametersJson,
|
|
State = JobState.Queued,
|
|
Created = DateTimeOffset.UtcNow,
|
|
};
|
|
|
|
private static Job Of(JobKind kind, string? parameters = null) => new()
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
Kind = kind,
|
|
TargetIds = [SequenceId],
|
|
ParametersJson = parameters,
|
|
State = JobState.Queued,
|
|
Created = DateTimeOffset.UtcNow,
|
|
};
|
|
|
|
[Test]
|
|
public void TransfersWithAServerAreHeld()
|
|
{
|
|
Assert.True(UploadHold.Holds(Of(JobKind.UploadCommit)));
|
|
// The sync's downloads too: the option's tooltip says "uploads and downloads".
|
|
Assert.True(UploadHold.Holds(Of(JobKind.Download)));
|
|
Assert.True(UploadHold.Holds(Of(WorkspaceJobs.CopyFromServer(SequenceId, "Harbour", Server, Root, ProjectId))));
|
|
Assert.True(UploadHold.Holds(Of(WorkspaceJobs.Send(SequenceId, "Harbour", Root, ProjectId, [], Server))));
|
|
Assert.SequenceEqual([JobKind.UploadCommit, JobKind.Download, JobKind.WorkspaceCopy, JobKind.WorkspaceSend], UploadHold.Kinds);
|
|
}
|
|
|
|
[Test]
|
|
public void TransfersWithThisPcsLibraryAndOtherJobsAreNot()
|
|
{
|
|
var sequence = new Sequence { Id = SequenceId, ArchiveId = Guid.CreateVersion7(), Title = "Harbour", Folder = "2026/harbour" };
|
|
Assert.False(UploadHold.Holds(Of(WorkspaceJobs.Copy(sequence, Root, ProjectId))));
|
|
Assert.False(UploadHold.Holds(Of(WorkspaceJobs.Send(SequenceId, "Harbour", Root, ProjectId, []))));
|
|
Assert.False(UploadHold.Holds(Of(JobKind.Render)));
|
|
// Parameters that cannot be read are not held: the job fails with its reason.
|
|
Assert.False(UploadHold.Holds(Of(JobKind.WorkspaceSend, "{not json")));
|
|
Assert.False(UploadHold.Holds(Of(JobKind.WorkspaceCopy)));
|
|
}
|
|
}
|