Harden NordVPN reconciliation and WebGUI testing
This commit is contained in:
parent
a115d2a012
commit
b4a30ca190
1 changed files with 777 additions and 97 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue