fix: report direct ssh login failures
This commit is contained in:
@@ -73,6 +73,26 @@ test('remote login url client validates helper output before returning it', func
|
||||
}
|
||||
});
|
||||
|
||||
test('remote login url client reports direct ssh failure diagnostics', function (): void {
|
||||
$settings = Settings::fromArray([
|
||||
'MAIL_LOGIN_TARGET_BASE_URL' => 'https://mx1.domena.pl:2222',
|
||||
'MX_LOGIN_MODE' => '1',
|
||||
]);
|
||||
$request = new LoginUrlRequest('mxtest', 'h4.domena.pl', 'h4', 30, true, '198.51.100.10', '/', 1782810000);
|
||||
$client = new RemoteLoginUrlClient(function (array $command, int $timeout): ProcessResult {
|
||||
return new ProcessResult(255, '', "Host key verification failed.\n");
|
||||
});
|
||||
|
||||
try {
|
||||
$client->create($settings, $request);
|
||||
throw new RuntimeException('Expected direct ssh failure to fail');
|
||||
} catch (RuntimeException $e) {
|
||||
assert_contains('MX direct SSH command failed', $e->getMessage());
|
||||
assert_contains('exit 255', $e->getMessage());
|
||||
assert_contains('Host key verification failed.', $e->getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
test('process runner returns stdout and exit code from real command', function (): void {
|
||||
$result = RemoteLoginUrlClient::runProcess(['php', '-r', 'echo "ok\n";'], 5);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user