test: stretch timed budgets on the shared CI runner
CI / Build and test (pull_request) Successful in 8m3s
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 14s
CI / PostgreSQL 16 integration (pull_request) Successful in 5m56s
CI / PostgreSQL 17 integration (pull_request) Successful in 6m5s
CI / Docker image (pull_request) Successful in 1m18s
CI / Build and test (pull_request) Successful in 8m3s
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 14s
CI / PostgreSQL 16 integration (pull_request) Successful in 5m56s
CI / PostgreSQL 17 integration (pull_request) Successful in 6m5s
CI / Docker image (pull_request) Successful in 1m18s
The owner's runner shares its CPU and disks with Gitea and the server's other containers, so the 100k-frame bulk insert took 10-19 s against 15 s from one run to the next. CHRONOS_TEST_TIME_FACTOR (default 1) stretches the timed tests' budgets; CI and release set 3, the weekly performance gates keep them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f4800fd86d
commit
8566072c9a
12 files changed
+55
-8
No files matched your search
@@ -0,0 +1,23 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace Chronos.Testing;
|
||||
|
||||
/// <summary>
|
||||
/// Time budgets of timed tests. <c>CHRONOS_TEST_TIME_FACTOR</c> (at least 1, default 1) stretches them on a CI runner
|
||||
/// that shares its CPU and disks with other services (the Gitea runner on the owner's server, amended 2026-10-23, R3);
|
||||
/// on a development PC the budgets apply as written, and the performance gates of <c>perf.yml</c> never set it.
|
||||
/// </summary>
|
||||
public static class TestTiming
|
||||
{
|
||||
public const string Variable = "CHRONOS_TEST_TIME_FACTOR";
|
||||
|
||||
/// <summary>The factor from <see cref="Variable"/>; 1 when unset, unreadable or below 1.</summary>
|
||||
public static double Factor { get; } = Parse(Environment.GetEnvironmentVariable(Variable));
|
||||
|
||||
/// <summary><paramref name="seconds"/> stretched by <see cref="Factor"/>.</summary>
|
||||
public static double Budget(double seconds) => seconds * Factor;
|
||||
|
||||
/// <summary>The factor a value of <see cref="Variable"/> gives.</summary>
|
||||
public static double Parse(string? value) =>
|
||||
double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var factor) && factor >= 1 && double.IsFinite(factor) ? factor : 1;
|
||||
}
|
||||
Reference in new issue
Block a user