Skip to content

Commit 3320f36

Browse files
net0wellclaude
andcommitted
ci: testes de tempo rodam sozinhos num passo próprio (specs 001, 006, 007)
No runner Linux do GitHub, dois testes que medem tempo falharam por poucos milissegundos enquanto os outros projetos de teste rodavam em paralelo: - AC-13 da spec 007: p95 de 665 ms com limite de 500 ms; - AC-7 da spec 001: 3,53 s com limite de 3,5 s. Os seis testes que verificam uma duração ganham a categoria Timing: - spec 001: AC-7 e AC-8; - spec 006: AC-5 e AC-9; - spec 007: AC-11 e AC-13. O passo principal os exclui. Um passo novo roda esses testes sozinhos, um de cada vez (--parallel none). Os limites das specs não mudam (D-188). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c528846 commit 3320f36

6 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,16 @@ jobs:
7979
# Testcontainers (Docker); GitHub's Windows runners cannot run Linux containers, so Windows runs the Core tests only.
8080
- name: Test
8181
if: runner.os == 'Linux'
82-
run: dotnet test --no-build --configuration Release --solution tests/PythonScriptRunner.SemE2E.slnf
82+
run: dotnet test --no-build --configuration Release --solution tests/PythonScriptRunner.SemE2E.slnf --filter-not-trait "Category=Timing"
83+
84+
# The tests that assert a duration (timeout, cancellation, latency, p95) run alone and one at a time: next to the
85+
# other test projects, the runner's shared CPU made them miss their limits by a few milliseconds (D-188).
86+
- name: Test (timing)
87+
if: runner.os == 'Linux'
88+
run: |
89+
for project in Core Dashboard Worker; do
90+
dotnet test --no-build --configuration Release --project "tests/PythonScriptRunner.$project.Tests" --filter-trait "Category=Timing" --parallel none
91+
done
8392
8493
# The panel E2E tests run alone: containers starting or stopping in the other test projects change the host's network
8594
# interfaces, and Chromium then aborts requests in flight with ERR_NETWORK_CHANGED.

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ A pull request is merged only when every job of `.github/workflows/ci.yml` is gr
4848
## Conventions
4949

5050
- **Tests:** every acceptance criterion and every fixed bug has a test. Integration tests run against real Python (uv),
51-
PostgreSQL and RabbitMQ (Testcontainers).
51+
PostgreSQL and RabbitMQ (Testcontainers). A test that asserts a duration gets `[Trait("Category", "Timing")]`: the CI
52+
runs those alone, one at a time (`--filter-trait "Category=Timing" --parallel none`).
5253
- **Public API:** public types and members have XML documentation (the build generates it and fails on warnings).
5354
- **Packages:** versions live in `Directory.Packages.props` (Central Package Management). Dependabot proposes updates
5455
every Monday.

‎tests/PythonScriptRunner.Core.Tests/Integration/IsolationTests.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace PythonScriptRunner.Core.Tests.Integration;
88
public sealed class IsolationTests(PythonFixture fixture)
99
{
1010
[Fact]
11+
[Trait("Category", "Timing")]
1112
public async Task Spec001_AC07_Timeout_KillsTheProcessTree()
1213
{
1314
// Arrange
@@ -44,6 +45,7 @@ with open(inputs["pid_file"], "w") as f:
4445
}
4546

4647
[Fact]
48+
[Trait("Category", "Timing")]
4749
public async Task Spec001_AC08_Cancellation_StopsTheRun()
4850
{
4951
await using var host = RunnerHost.Create(fixture, b => b.AddStage("espera", s => s.Script("""

‎tests/PythonScriptRunner.Dashboard.Tests/PerformanceTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public sealed class PerformanceTests(PostgresFixture postgres, BrokerFixture bro
1616
private static CancellationToken Ct => TestContext.Current.CancellationToken;
1717

1818
[Fact]
19+
[Trait("Category", "Timing")]
1920
public async Task Spec007_AC13_MainReadsWith90DaysOfRuns_AnswerWithP95Under500Ms()
2021
{
2122
var perDay = int.TryParse(Environment.GetEnvironmentVariable("PSR_PERF_RUNS_PER_DAY"), CultureInfo.InvariantCulture, out var configured)

‎tests/PythonScriptRunner.Dashboard.Tests/RealtimeTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public sealed class RealtimeTests(PostgresFixture postgres, BrokerFixture broker
1414
private static CancellationToken Ct => TestContext.Current.CancellationToken;
1515

1616
[Fact]
17+
[Trait("Category", "Timing")]
1718
public async Task Spec007_AC11_SubscribedClientsOfTwoInstances_ReceiveStepAndRunUpdatesInUnderOneSecond()
1819
{
1920
await using var env = await PsrEnvironment.CreateAsync(postgres, broker, python);

‎tests/PythonScriptRunner.Worker.Tests/RecoveryTests.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public sealed class RecoveryTests(PostgresFixture postgres, BrokerFixture broker
1010
private static CancellationToken Ct => TestContext.Current.CancellationToken;
1111

1212
[Fact]
13+
[Trait("Category", "Timing")]
1314
public async Task Spec006_AC05_LostWorker_IdempotentStepIsRecoveredByAnother()
1415
{
1516
await using var env = await PsrEnvironment.CreateAsync(postgres, broker, python);
@@ -49,6 +50,7 @@ public async Task Spec006_AC06_LostWorker_NonIdempotentStepFailsAndReprocessComp
4950
}
5051

5152
[Fact]
53+
[Trait("Category", "Timing")]
5254
public async Task Spec006_AC09_Cancel_StopsTheProcessInTheWorker()
5355
{
5456
await using var env = await PsrEnvironment.CreateAsync(postgres, broker, python);

0 commit comments

Comments
 (0)