mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-26 19:03:17 +01:00
fix(watchdog): pin the heartbeat telemetry fixes with stronger tests
Review follow-up to the bandwidth/rps/producers fix. The nginx stub_status parse moves into SystemInfo::nginxRequestCount(), so the requests field the watchdog samples is tested against a real status body and an unreachable one (no count, rps 0). The getStats() test now pins the whole array_replace statement (a `+` would leave the bandwidth keys at 0), and the sampler test checks that 120 s is in range by default. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQHeypQpfAXTdCysmi7b6a
This commit is contained in:
@@ -67,6 +67,7 @@ final class CounterRateSamplerTest extends TestCase {
|
||||
$rSampler = new CounterRateSampler($this->rFile);
|
||||
$rSampler->sample(1000, 100);
|
||||
$this->assertSame(0, $rSampler->sample(2210, 221));
|
||||
$this->assertSame(10, $rSampler->sample(3410, 341), '120 s is in range by default');
|
||||
}
|
||||
|
||||
public function testACorruptStateFileIsZeroAndOverwritten(): void {
|
||||
@@ -92,6 +93,7 @@ final class CounterRateSamplerTest extends TestCase {
|
||||
$this->assertFileExists($rPath);
|
||||
$rSource = (string) file_get_contents($rPath);
|
||||
|
||||
$this->assertStringContainsString('SystemInfo::nginxRequestCount(', $rSource);
|
||||
$this->assertStringContainsString('new CounterRateSampler(TMP_PATH . ', $rSource);
|
||||
$this->assertStringNotContainsString('$rLastRequests', $rSource, 'a per-process previous reading is always null');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user