Skip to content

Commit 6168080

Browse files
committed
TraceContext テストの Windows assertion 緩和
testElapsedMsIncreasesOverTime も assertion 下限を 5ms → 1ms に緩和。 533a74e で ElapsedTimeProcessorTest を緩和したが、同種のテストが TraceContextTest にも存在し、こちらが Windows runner で fail していた。 両ファイルで同じ flaky 対策パターン (usleep 30ms + 1ms 以上) に統一。 機能変更なし、テスト assertion のみ。
1 parent 533a74e commit 6168080

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/Unit/Log/TraceContextTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ public function testElapsedMsIsNonNegative(): void
110110
public function testElapsedMsIncreasesOverTime(): void
111111
{
112112
$context = new TraceContext();
113-
usleep(5_000); // 5ms
113+
// CI's Windows runner intermittently reports far fewer ms elapsed than
114+
// the actual usleep duration (timer resolution + scheduler jitter).
115+
// Loosen the lower bound to verify only "some elapsed time was
116+
// measured" rather than a specific minimum, keeping the intent
117+
// (elapsed_ms grows after a wait) without environment-dependent flakes.
118+
usleep(30_000);
114119
$elapsed = $context->elapsedMs();
115120

116-
$this->assertGreaterThanOrEqual(5, $elapsed);
121+
$this->assertGreaterThanOrEqual(1, $elapsed);
117122
}
118123
}

0 commit comments

Comments
 (0)