mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
test(ssh): reset both session-hold stores in the shared SSH connection fixture
The fixture reset now clears credential declines as well as user disconnects, so every suite built on it starts without a stale hold from an earlier file in the same worker. The per-suite resets it supersedes are removed. Fixes #40291
This commit is contained in:
@@ -8,10 +8,7 @@ import {
|
||||
import { resetSshConnectionMocks } from './testing/ssh-connection-test-harness'
|
||||
import { createCallbacks, createTarget } from './testing/ssh-connection-test-fixtures'
|
||||
import { SshConnectionManager } from './ssh-connection-manager'
|
||||
import {
|
||||
recordSshCredentialDeclined,
|
||||
resetSshCredentialDeclinesForTests
|
||||
} from '../authentication/ssh-credential-decline'
|
||||
import { recordSshCredentialDeclined } from '../authentication/ssh-credential-decline'
|
||||
|
||||
vi.mock('../authentication/ssh2-module-load', async () =>
|
||||
(await import('./testing/ssh-connection-test-client')).createSsh2LoaderModule()
|
||||
@@ -66,7 +63,6 @@ describe('SshConnectionManager on a password host', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
resetSshConnectionMocks()
|
||||
resetSshCredentialDeclinesForTests()
|
||||
vi.stubEnv('SSH_AUTH_SOCK', '')
|
||||
onCredentialRequest.mockClear()
|
||||
manager = new SshConnectionManager(createCallbacks({ onCredentialRequest }))
|
||||
|
||||
@@ -17,7 +17,7 @@ import { SshConnection } from './ssh-connection'
|
||||
import { resolveWithSshG } from '../config/ssh-g-config-resolution'
|
||||
|
||||
import { RECONNECT_BACKOFF_MS } from './ssh-connection-timing'
|
||||
import { recordSshUserDisconnected, resetSshUserDisconnectsForTests } from './ssh-user-disconnect'
|
||||
import { recordSshUserDisconnected } from './ssh-user-disconnect'
|
||||
|
||||
vi.mock('../authentication/ssh2-module-load', async () =>
|
||||
(await import('./testing/ssh-connection-test-client')).createSsh2LoaderModule()
|
||||
@@ -86,7 +86,6 @@ async function spendLadderWhileAsleep(conn: SshConnection): Promise<void> {
|
||||
describe('SshConnection retry after wake or network return', () => {
|
||||
beforeEach(() => {
|
||||
resetSshConnectionMocks()
|
||||
resetSshUserDisconnectsForTests()
|
||||
vi.useFakeTimers()
|
||||
})
|
||||
afterEach(() => {
|
||||
|
||||
@@ -11,6 +11,7 @@ import type * as SystemSshFileBinaryTransfer from '../../system-transport/file-t
|
||||
import type * as SystemSshFileTransfer from '../../system-transport/file-transfer/system-ssh-file-transfer'
|
||||
import type * as SshGConfigResolution from '../../config/ssh-g-config-resolution'
|
||||
import { resetSsh2ClientState, ssh2Mock } from './ssh-connection-test-client'
|
||||
import { resetSshCredentialDeclinesForTests } from '../../authentication/ssh-credential-decline'
|
||||
import { resetSshUserDisconnectsForTests } from '../ssh-user-disconnect'
|
||||
|
||||
export type SystemSshBinaryModuleMock = { findSystemSsh: typeof findSystemSshMock }
|
||||
@@ -106,6 +107,8 @@ export function withSshGConfigResolutionMocks(actual: typeof SshGConfigResolutio
|
||||
}
|
||||
|
||||
export function resetSshConnectionMocks(): void {
|
||||
// Session holds are module state that outlives a file in a shared worker; a stale hold refuses the next suite's dial.
|
||||
resetSshCredentialDeclinesForTests()
|
||||
resetSshUserDisconnectsForTests()
|
||||
resetSsh2ClientState()
|
||||
getOrcaControlSocketPathMock.mockReset()
|
||||
|
||||
Reference in New Issue
Block a user