Skip to content

Commit d2a6c35

Browse files
committed
Keep SSH2 auth failure test isolated
Limit the descriptor-leak regression to one warmup failure and one observed failure. This remains sufficient to detect the leaked session descriptor while staying below OpenSSH 9.8+'s default per-source penalty floor. Document the limit so later test expansion does not temporarily block unrelated tests sharing the SSH server.
1 parent 30ada7a commit d2a6c35

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

tests/swoole_ssh2/ssh2_sftp_wrapper_session_ownership.phpt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,17 @@ Co\run(function (): void {
2828
);
2929
$fileDescriptorCount = static fn (): int => count(scandir('/proc/self/fd')) - 2;
3030

31-
$warmupFailed = @fopen($url, 'rb', false, $context) === false;
32-
$baseline = $fileDescriptorCount();
33-
$attemptsFailed = true;
31+
$warmupFailed = @fopen($url, 'rb', false, $context) === false;
32+
$baseline = $fileDescriptorCount();
3433

35-
for ($attempt = 0; $attempt < 3; $attempt++) {
36-
$attemptsFailed = @fopen($url, 'rb', false, $context) === false && $attemptsFailed;
37-
}
34+
// Keep the two failures below OpenSSH 9.8+'s default per-source penalty floor
35+
// so this test cannot block later tests that share the SSH server.
36+
$attemptFailed = @fopen($url, 'rb', false, $context) === false;
3837

3938
gc_collect_cycles();
4039

4140
var_dump($warmupFailed);
42-
var_dump($attemptsFailed);
41+
var_dump($attemptFailed);
4342
var_dump($fileDescriptorCount() === $baseline);
4443
});
4544
?>

0 commit comments

Comments
 (0)