Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5acdf146c7 | ||
|
|
f80fc148bf |
No files matched your search
+2
-1
@@ -1134,7 +1134,8 @@ for HEIC/RAW so the server can render without a node.
|
||||
repository** (§19.4), `<server>/api/v1/repos/<owner>/<name>/releases?draft=false&pre-release=false`,
|
||||
takes the highest version (a pre-release build is offered the final release of its own
|
||||
version; a 404, a repository the client cannot see, is a failed check, not "up to date"),
|
||||
and shows a one-line notice with "Download" (P1: download
|
||||
builds the release page and download links from `ChronosReleasesUrl` (Gitea writes its own
|
||||
with its ROOT_URL, which clients may not reach), and shows a one-line notice with "Download" (P1: download
|
||||
installer, verify SHA-256 from `SHA256SUMS`, run it). The repository is the build
|
||||
property `ChronosReleasesUrl` (default `https://gitea.encke-hake.ts.net/BalboSoft/Chronos`),
|
||||
which also gives the licence link (`<repository>/src/branch/main/EULA.md`), the issues
|
||||
|
||||
@@ -5,6 +5,13 @@ commits follow Conventional Commits (release notes are generated from them by `C
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.0-rc.2] — 2026-10-23
|
||||
|
||||
### Fixed
|
||||
- Update check: the release page and the download links come from the repository address the build names
|
||||
(`ChronosReleasesUrl`), not from Gitea's answer, whose links use Gitea's ROOT_URL; with the owner's plain-http LAN
|
||||
ROOT_URL every release was ignored (the check accepts only https links).
|
||||
|
||||
## [0.1.0-rc.1] — 2026-10-23
|
||||
|
||||
First pre-release, built and published by Gitea Actions.
|
||||
|
||||
+2
-1
@@ -427,4 +427,5 @@ One line per decision: date · decision · alternative · reason.
|
||||
| 2026-10-23 | The server image is built for linux/amd64 only and pushed to the Gitea container registry (`<host of PUBLIC_URL>/<owner>/chronos-server`) with the `REGISTRY_TOKEN` secret; `:latest` moves only to the highest stable version among the published releases, read back after publishing. The workflow's own token is refused by the organisation's registry (measured), so without the secret the image job fails with instructions while the release itself is already published. (R3.) | Multi-arch with QEMU; fail the whole release | Multi-arch needs QEMU's binfmt handlers installed on the owner's host, a change to the host outside the repository; the Windows programs should not wait on a registry credential. |
|
||||
| 2026-10-23 | The Windows-only CI (Core.Windows and App tests, screenshots and their diff, the installer test) is the `windows` job, run only when the repository variable `WINDOWS_RUNNER` names a Windows act_runner in host mode; until then those tests run on a Windows PC before a merge. The Definition of Done says so (CLAUDE.md, BRIEF Appendix A). (R3.) | Drop them; fail CI without a Windows runner | They are the only automatic proof of the installer and the screens; a job that waits for a runner that does not exist would hold every run. |
|
||||
| 2026-10-23 | Update check: the client reads the published stable releases and takes the highest version, because Gitea's `releases/latest` is the most recently created release (a re-published older tag or a backport would become it); a pre-release build (`0.1.0-rc.1`) is offered the final release of its own version, which it used to call "up to date" forever; a 404 is a failed check, because Gitea answers 404 for a repository the client may not see (the `BalboSoft` organisation is private today) and that used to read as "up to date". The release workflow picks `:latest` the same way. `gitea-release` checks every file's size before it publishes, and when it replaces the files of a release clients can already see it removes the old `SHA256SUMS` first and uploads the new one last. (R2, R3; independent review of this change.) | Trust `releases/latest`; leave the pre-release rule as it was | The first release is a pre-release: its testers must be told when 0.1.0 is out; a download checked against the checksums of another build would be refused. |
|
||||
| 2026-10-23 | Timed tests (bulk insert, JPEG and RAW decode, resampler, light analysis, metadata robustness, scroll smoke) take their budget from `TestTiming.Budget`, stretched by `CHRONOS_TEST_TIME_FACTOR` (at least 1, default 1); ci.yml and release.yml set 3, perf.yml nothing. On the owner's runner, which shares its CPU and disks with Gitea and the server's other containers, the 100k-frame SQLite bulk insert took 10–19 s against 15 s from one run to the next. (R3.) | Raise the budgets; move the timed tests to perf.yml | The budgets stay what a developer's PC must meet and the weekly performance gates measure them unstretched; a CI run fails on a real regression, not on a busy host. |
|
||||
| 2026-10-23 | Timed tests (bulk insert, JPEG and RAW decode, resampler, light analysis, metadata robustness, scroll smoke, and the lease renewal test's timer periods) take their budget from `TestTiming.Budget`, stretched by `CHRONOS_TEST_TIME_FACTOR` (at least 1, default 1); ci.yml and release.yml set 3, perf.yml nothing. On the owner's runner, which shares its CPU and disks with Gitea and the server's other containers, the 100k-frame SQLite bulk insert took 10–19 s against 15 s from one run to the next. (R3.) | Raise the budgets; move the timed tests to perf.yml | The budgets stay what a developer's PC must meet and the weekly performance gates measure them unstretched; a CI run fails on a real regression, not on a busy host. |
|
||||
| 2026-10-23 | The update check builds the release page (`<repository>/releases/tag/<tag>`) and the download links (`<repository>/releases/download/<tag>/<name>`) from `ChronosReleasesUrl` and takes only the tags, names and sizes from Gitea's answer: Gitea writes `html_url` and `browser_download_url` with its ROOT_URL, the owner's being `http://192.168.30.23:3000`, so the first release's links were plain http on a LAN address and the https-only check ignored the release. Without a repository address (tests) the answer's links are used as before. (R2, after the first release.) | Ask the owner to set ROOT_URL to the public https name | The build already names the address its users reach; the client then works whatever Gitea's ROOT_URL is, and a ROOT_URL change stays the owner's choice. |
|
||||
+3
-3
@@ -15,7 +15,7 @@ by its `windows` job once a Windows runner is registered (`WINDOWS_RUNNER`), and
|
||||
| 7 Server, sync, uploader | Done: server (API, auth, uploads, jobs, render nodes, events, admin panel with light and dark themes, Windows service), Uploader, client sync (sync table, conflicts with *Save both*, proxies kept offline, metered pause), server sequences edited with proxies and rendered where the originals are, this PC as a render node. Gate covered in-process: a sequence uploaded from one PC downloads identically on another, interrupted uploads and downloads resume, server events update a PC, renders run on a node and on the server's managed fallback, jobs resume after a restart, sign-ins and administrative actions are audited. The run with two real PCs and the Uploader against the Docker server is part of the release test. |
|
||||
| 8 Release readiness | Release pipeline end to end (installers, portable and server zips, SHA256SUMS, release notes, optional signing, server image in the Gitea container registry, optional separate releases repository), update check with verified download, scrubbed diagnostics bundles (desktop and server), performance gates, 38 cultures (`en`, `it` and 36 machine translations with glossaries and independent reviews), RTL pass (`ar`, `he`: mirrored windows, left-to-right islands for media, charts, numbers and paths; any right-to-left culture added later follows), accessibility pass (names, live regions, keyboard paths for charts and the curve editor). The installer test (silent install of the packed installers, run, upgrade in place, uninstall: files, Add/Remove Programs, shortcuts, file type, user data kept, exit codes) runs in CI's `windows` job on a Windows runner. Pending: the interactive install on a real PC, Unraid template validation on a real server. |
|
||||
| 8.1 Owner review 1 | In progress (request, answers and plan: `docs/requests/2026-10-15-owner-review-1.md`). Phase 1 done: stalled thumbnail and proxy jobs no longer fail and stay Running (frame-counted progress, bounded time left, final state always written); the editor's cancelled decodes stay in their tasks (no debugger stops in `WicDecoderProvider.cs`); WIC decodes RAW only through the Raw Image Extension and never DNG; GoPro DNGs converted by Adobe software are DNGs, developed natively for videos, read through their embedded preview for analyses and previews, and reclassified in existing archives by the next light analysis. Phase 2 done: jobs run one at a time on the desktop and the server; Parallelism is how many photos the running job processes at once (thumbnail and proxy passes, tier probes, deep analysis, render decodes); pausing the running job starts the next; an optional priority queue by job kind (Settings › Rendering, admin panel › Settings › Jobs, `CHRONOS_PRIORITY_QUEUE`) pauses lower jobs and resumes them by themselves; `CHRONOS_PARALLELISM` replaces `CHRONOS_WORKERS`. Phase 3a done: the rail is 200 px and collapses to icons with ≡ or Ctrl+B (tooltips then name the sections, the choice saved at once); the admin panel's sidebar is 256 px and collapses the same way. Phase 3b done: the Sequence section is now Edit, one sequence at a time chosen in a picker inside the section (Change sequence, Ctrl+O; the sequence edited last selected first), and the editor's tabs are the steps of a guided, freely navigable path from a new Analysis step (every finding with the step that deals with it) to Export, each step showing where it stands, with Previous and Next. Next: phase 4, the visual crop locked to the output's proportions (R5) and mirroring, 90° rotations, straightening and colour filters (R6). |
|
||||
| 8.2 Chronos on Gitea | Done (request: `docs/requests/2026-10-23-chronos-gitea.md`): Titano renamed Chronos everywhere, translations' grammar included; repository, update check, links, issue forms and registry moved to the self-hosted Gitea; Gitea Actions CI, release, nightly image and performance workflows for the Linux runner, with the Windows programs cross-compiled and checked (`pe-check`); new `Chronos.Tools` commands `zip`, `gitea-release`, `postgres-ci`, `pe-check`. First pre-release `v0.1.0-rc.1` tagged; its server image waits for the `REGISTRY_TOKEN` secret. |
|
||||
| 8.2 Chronos on Gitea | Done (request: `docs/requests/2026-10-23-chronos-gitea.md`): Titano renamed Chronos everywhere, translations' grammar included; repository, update check, links, issue forms and registry moved to the self-hosted Gitea; Gitea Actions CI, release, nightly image and performance workflows for the Linux runner, with the Windows programs cross-compiled and checked (`pe-check`); new `Chronos.Tools` commands `zip`, `gitea-release`, `postgres-ci`, `pe-check`. Pre-releases `v0.1.0-rc.1` and `v0.1.0-rc.2` (the update check builds its links from `ChronosReleasesUrl`, since Gitea's use its LAN ROOT_URL) published; their server images wait for the `REGISTRY_TOKEN` secret. |
|
||||
| 9 Monetization | Not started: requires explicit approval (§22). |
|
||||
|
||||
## Verification (2026-10-12)
|
||||
@@ -68,7 +68,7 @@ src/Chronos.App/bin/Release/net10.0-windows/Chronos.exe --capture out/screenshot
|
||||
## Next steps (Phase 8 gate)
|
||||
|
||||
1. Server image: create an access token with *package: read and write*, save it as the repository secret
|
||||
`REGISTRY_TOKEN`, then re-run the *Server image* job of the `v0.1.0-rc.1` release run (Actions › Release).
|
||||
`REGISTRY_TOKEN`, then re-run the *Server image* job of the `v0.1.0-rc.2` release run (Actions › Release).
|
||||
2. Visibility: make the `BalboSoft` organisation (and its packages) public, or publish to a public `RELEASES_REPO`, so
|
||||
that people without an account can download releases, get update notices and pull the image.
|
||||
3. Windows runner: register an act_runner in host mode on a Windows PC (.NET SDK, Git for Windows, PowerShell 7) and set
|
||||
@@ -76,7 +76,7 @@ src/Chronos.App/bin/Release/net10.0-windows/Chronos.exe --capture out/screenshot
|
||||
of the first green `windows` job of a pull request, run `dotnet run --project src/Chronos.Tools -- screenshots accept
|
||||
<dir>` and commit the PNGs to `tests/visual/baselines` (its README says how). From then on a visual change, or a
|
||||
screen without a baseline, fails the `windows` job.
|
||||
4. On Windows: install the `v0.1.0-rc.1` setup, upgrade over the previous version, uninstall (with and without user
|
||||
4. On Windows: install the `v0.1.0-rc.2` setup, upgrade over the previous version, uninstall (with and without user
|
||||
data), silent mode.
|
||||
5. Unraid: install the template as a user template (README › Server image, Compose and Unraid) with the official
|
||||
PostgreSQL template, check that its icon (the SVG of `branding/`) shows, reach the WebUI.
|
||||
|
||||
@@ -48,4 +48,5 @@ Nothing blocked the work; these need the owner because they are the owner's sett
|
||||
| Phase | State | Commit | BRIEF | DECISIONS |
|
||||
|---|---|---|---|---|
|
||||
| R1 rename, R2 Gitea references, R3 workflows and tools | Done | `refactor!: rename Titano to Chronos and move CI and releases to Gitea` | §0.2, §3, §16, §18, §19, §20.2, §21, §22, §23, §24, Appendix A | rows dated 2026-10-23 |
|
||||
| First release `v0.1.0-rc.1` | Tagged after the merge into `main`; the server image waits for `REGISTRY_TOKEN` | — | — | — |
|
||||
| First release `v0.1.0-rc.1` | Published after the merge into `main`; the server image waits for `REGISTRY_TOKEN` | `refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)` | — | — |
|
||||
| Update links, `v0.1.0-rc.2` | Published: the update check builds its links from `ChronosReleasesUrl` (Gitea's use its LAN ROOT_URL); the server image waits for `REGISTRY_TOKEN` | `fix(app): build update links from the releases repository address (#7)` | §18 | row dated 2026-10-23 (update links) |
|
||||
@@ -16,7 +16,10 @@ public sealed record ReleaseAsset(string Name, string DownloadUrl, long Size);
|
||||
/// <summary>
|
||||
/// Update check against the Gitea releases API of the releases repository (BRIEF §18, §19.4, amended 2026-10-23, R2):
|
||||
/// reads the published stable releases, takes the highest version (Gitea's own "latest" is the most recently created
|
||||
/// one, which a re-published older tag or a backport would become), and compares it with the running version.
|
||||
/// one, which a re-published older tag or a backport would become), and compares it with the running version. The
|
||||
/// release page and download links are built from the repository address the build names (ChronosReleasesUrl), not
|
||||
/// taken from the answer: Gitea writes its links with its ROOT_URL, which may be an address clients cannot reach
|
||||
/// (the owner's is a plain-http LAN address).
|
||||
/// </summary>
|
||||
public static class UpdateCheck
|
||||
{
|
||||
@@ -35,30 +38,36 @@ public static class UpdateCheck
|
||||
|
||||
/// <summary>
|
||||
/// The newest release of a releases-list response (an array: the highest version wins) or of one release object;
|
||||
/// null when there is none. Drafts, pre-releases, unparsable tags and pages without an https link are skipped, and
|
||||
/// so are assets without an https download link.
|
||||
/// null when there is none. With <paramref name="repository"/> ("https://host/owner/name"), the release page and
|
||||
/// the download links are that repository's (<c>/releases/tag/<tag></c>, <c>/releases/download/<tag>/<name></c>);
|
||||
/// without it, the ones in the answer. Drafts, pre-releases, unparsable tags and pages without an https link are
|
||||
/// skipped, and so are assets without an https download link.
|
||||
/// </summary>
|
||||
public static ReleaseInfo? Parse(string json)
|
||||
public static ReleaseInfo? Parse(string json, string? repository = null)
|
||||
{
|
||||
var baseUrl = repository?.Trim().TrimEnd('/');
|
||||
using var document = JsonDocument.Parse(json);
|
||||
var root = document.RootElement;
|
||||
return root.ValueKind switch
|
||||
{
|
||||
JsonValueKind.Array => root.EnumerateArray().Select(ParseRelease).OfType<ReleaseInfo>().MaxBy(r => r.Version),
|
||||
JsonValueKind.Object => ParseRelease(root),
|
||||
JsonValueKind.Array => root.EnumerateArray().Select(r => ParseRelease(r, baseUrl)).OfType<ReleaseInfo>().MaxBy(r => r.Version),
|
||||
JsonValueKind.Object => ParseRelease(root, baseUrl),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
private static ReleaseInfo? ParseRelease(JsonElement root)
|
||||
private static ReleaseInfo? ParseRelease(JsonElement root, string? repository)
|
||||
{
|
||||
if (root.ValueKind != JsonValueKind.Object) return null;
|
||||
if (Flag(root, "draft") || Flag(root, "prerelease")) return null;
|
||||
var tag = root.TryGetProperty("tag_name", out var t) && t.ValueKind == JsonValueKind.String ? t.GetString() : null;
|
||||
var url = root.TryGetProperty("html_url", out var u) && u.ValueKind == JsonValueKind.String ? u.GetString() : null;
|
||||
var version = ParseVersion(tag);
|
||||
if (version is null || tag is null || url is null || !url.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) return null;
|
||||
return new ReleaseInfo(version, tag, url) { Assets = ParseAssets(root) };
|
||||
if (version is null || tag is null) return null;
|
||||
var url = repository is not null
|
||||
? $"{repository}/releases/tag/{Uri.EscapeDataString(tag)}"
|
||||
: root.TryGetProperty("html_url", out var u) && u.ValueKind == JsonValueKind.String ? u.GetString() : null;
|
||||
if (url is null || !url.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) return null;
|
||||
return new ReleaseInfo(version, tag, url) { Assets = ParseAssets(root, repository, tag) };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -91,7 +100,15 @@ public static class UpdateCheck
|
||||
/// that is a failed check, never "up to date".
|
||||
/// </summary>
|
||||
/// <exception cref="HttpRequestException">The request failed, or the repository was not found.</exception>
|
||||
public static async Task<ReleaseInfo?> FetchAsync(HttpClient http, string apiUrl, string userAgentVersion, CancellationToken ct)
|
||||
public static Task<ReleaseInfo?> FetchAsync(HttpClient http, string apiUrl, string userAgentVersion, CancellationToken ct) =>
|
||||
FetchAsync(http, apiUrl, null, userAgentVersion, ct);
|
||||
|
||||
/// <summary>
|
||||
/// As <see cref="FetchAsync(HttpClient, string, string, CancellationToken)"/>, with the release page and download
|
||||
/// links built from <paramref name="repository"/> (see <see cref="Parse"/>).
|
||||
/// </summary>
|
||||
/// <exception cref="HttpRequestException">The request failed, or the repository was not found.</exception>
|
||||
public static async Task<ReleaseInfo?> FetchAsync(HttpClient http, string apiUrl, string? repository, string userAgentVersion, CancellationToken ct)
|
||||
{
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
request.Headers.UserAgent.Add(new ProductInfoHeaderValue("Chronos", userAgentVersion));
|
||||
@@ -103,7 +120,7 @@ public static class UpdateCheck
|
||||
var json = await response.Content.ReadAsStringAsync(ct).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
return Parse(json);
|
||||
return Parse(json, repository);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
@@ -111,7 +128,7 @@ public static class UpdateCheck
|
||||
}
|
||||
}
|
||||
|
||||
private static List<ReleaseAsset> ParseAssets(JsonElement root)
|
||||
private static List<ReleaseAsset> ParseAssets(JsonElement root, string? repository, string tag)
|
||||
{
|
||||
var assets = new List<ReleaseAsset>();
|
||||
if (!root.TryGetProperty("assets", out var list) || list.ValueKind != JsonValueKind.Array) return assets;
|
||||
@@ -119,7 +136,9 @@ public static class UpdateCheck
|
||||
{
|
||||
if (a.ValueKind != JsonValueKind.Object) continue;
|
||||
var name = a.TryGetProperty("name", out var n) && n.ValueKind == JsonValueKind.String ? n.GetString() : null;
|
||||
var link = a.TryGetProperty("browser_download_url", out var d) && d.ValueKind == JsonValueKind.String ? d.GetString() : null;
|
||||
var link = repository is not null && !string.IsNullOrEmpty(name)
|
||||
? $"{repository}/releases/download/{Uri.EscapeDataString(tag)}/{Uri.EscapeDataString(name)}"
|
||||
: a.TryGetProperty("browser_download_url", out var d) && d.ValueKind == JsonValueKind.String ? d.GetString() : null;
|
||||
var size = a.TryGetProperty("size", out var z) && z.ValueKind == JsonValueKind.Number && z.TryGetInt64(out var bytes) ? bytes : -1;
|
||||
if (string.IsNullOrEmpty(name) || link is null || !link.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) continue;
|
||||
assets.Add(new ReleaseAsset(name, link, size));
|
||||
|
||||
@@ -71,7 +71,7 @@ public sealed class AppServices : IAsyncDisposable
|
||||
Server = new ServerSession(settings, saveSettings, new ChronosServerApiFactory(), new DpapiTokenProtector());
|
||||
Encoders = new MediaFoundationInventory();
|
||||
Formats = new WicFormatInventory(() => _wic);
|
||||
CheckForUpdateAsync = ct => UpdateCheck.FetchAsync(Http.Value, ProductLinks.StableReleasesApi, VersionText, ct);
|
||||
CheckForUpdateAsync = ct => UpdateCheck.FetchAsync(Http.Value, ProductLinks.StableReleasesApi, ProductLinks.Repository, VersionText, ct);
|
||||
DownloadUpdateAsync = (release, progress, ct) =>
|
||||
UpdateDownload.DownloadAsync(DownloadHttp.Value, release, environment.IsPortable, UpdateDownload.Root(Path.GetTempPath()), VersionText, progress,
|
||||
UpdateDownload.IdleTimeout, ct);
|
||||
|
||||
@@ -82,6 +82,31 @@ public sealed class UpdateCheckTests
|
||||
await Assert.ThrowsAsync<HttpRequestException>(() => UpdateCheck.FetchAsync(broken, Api, "0.1.0", CancellationToken.None));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task LinksComeFromTheRepositoryAddressNotFromGiteasRootUrl()
|
||||
{
|
||||
// The owner's Gitea writes its links with its ROOT_URL, a plain-http LAN address clients cannot use.
|
||||
const string json = """
|
||||
[ { "tag_name": "v1.0.0", "html_url": "http://192.168.30.23:3000/BalboSoft/Chronos/releases/tag/v1.0.0",
|
||||
"assets": [ { "name": "Chronos-Setup-1.0.0.exe", "size": 5, "browser_download_url": "http://192.168.30.23:3000/BalboSoft/Chronos/releases/download/v1.0.0/Chronos-Setup-1.0.0.exe" },
|
||||
{ "name": "Read me.txt", "size": 2, "browser_download_url": "http://192.168.30.23:3000/x" } ] } ]
|
||||
""";
|
||||
Assert.Null(UpdateCheck.Parse(json));
|
||||
|
||||
var release = UpdateCheck.Parse(json, "https://gitea.example/BalboSoft/Chronos/")!;
|
||||
Assert.Equal("https://gitea.example/BalboSoft/Chronos/releases/tag/v1.0.0", release.PageUrl);
|
||||
Assert.SequenceEqual(
|
||||
["https://gitea.example/BalboSoft/Chronos/releases/download/v1.0.0/Chronos-Setup-1.0.0.exe",
|
||||
"https://gitea.example/BalboSoft/Chronos/releases/download/v1.0.0/Read%20me.txt"],
|
||||
release.Assets.Select(a => a.DownloadUrl));
|
||||
Assert.Equal(5L, release.Assets[0].Size);
|
||||
Assert.Null(UpdateCheck.Parse(json, "http://gitea.example/BalboSoft/Chronos"));
|
||||
|
||||
using var ok = new HttpClient(new Reply(HttpStatusCode.OK, json));
|
||||
var fetched = await UpdateCheck.FetchAsync(ok, Api, "https://gitea.example/BalboSoft/Chronos", "0.1.0", CancellationToken.None);
|
||||
Assert.Equal("https://gitea.example/BalboSoft/Chronos/releases/tag/v1.0.0", fetched!.PageUrl);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ARepositoryThatCannotBeSeenIsAFailedCheckNotUpToDate()
|
||||
{
|
||||
|
||||
@@ -66,12 +66,14 @@ public sealed class LeaseFileTests(TestContext context)
|
||||
public async Task AHeldLeaseIsRenewedPastItsDuration()
|
||||
{
|
||||
var locks = context.CreateTempDirectory();
|
||||
using var lease = LeaseFile.TryAcquire(locks, "seq-1", "server", TimeSpan.FromMilliseconds(300));
|
||||
// Renewals run on timers: a busy CI host delays them, so the lease's duration stretches with the time budgets.
|
||||
var duration = TimeSpan.FromSeconds(TestTiming.Budget(0.3));
|
||||
using var lease = LeaseFile.TryAcquire(locks, "seq-1", "server", duration);
|
||||
Assert.NotNull(lease);
|
||||
await Task.Delay(900);
|
||||
await Task.Delay(duration * 3);
|
||||
Assert.True(lease.IsHeld);
|
||||
Assert.Greater((LeaseFile.Read(lease.Path)!.Expires - DateTimeOffset.UtcNow).TotalMilliseconds, 0);
|
||||
Assert.Null(LeaseFile.TryAcquire(locks, "seq-1", "client", TimeSpan.FromMilliseconds(300)));
|
||||
Assert.Null(LeaseFile.TryAcquire(locks, "seq-1", "client", duration));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user