Harden NordVPN reconciliation and WebGUI testing

This commit is contained in:
ms2k 2026-08-07 02:30:26 +09:00
commit b4a30ca190

View file

@ -6,6 +6,33 @@ use PHPUnit\Framework\TestCase;
final class SystemRunnerAndHealthTest extends TestCase
{
public function testRunDrainsStderr(): void
{
$runner = new SystemRunner(null, 2);
$output = $runner->run([
PHP_BINARY,
'-r',
'fwrite(STDERR, str_repeat("x", 262144)); echo "done";',
]);
self::assertSame('done', $output);
}
public function testRunTimesOut(): void
{
$runner = new SystemRunner(null, 1);
$started = hrtime(true);
try {
$runner->run([PHP_BINARY, '-r', 'while (true) { usleep(100000); }']);
self::fail('Expected the system command to time out.');
} catch (\RuntimeException $exception) {
self::assertSame('System command timed out.', $exception->getMessage());
}
self::assertLessThan(3, (hrtime(true) - $started) / 1_000_000_000);
}
public function testTunnelHealthRequiresRecentHandshake(): void
{
$runner = new SystemRunner(static fn() => "public-key\t900\n");