diff --git a/src/main/ssh/connection/ssh-connection-manager-sign-in-reuse.test.ts b/src/main/ssh/connection/ssh-connection-manager-sign-in-reuse.test.ts index 679155ab77e..200f800fce4 100644 --- a/src/main/ssh/connection/ssh-connection-manager-sign-in-reuse.test.ts +++ b/src/main/ssh/connection/ssh-connection-manager-sign-in-reuse.test.ts @@ -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 })) diff --git a/src/main/ssh/connection/ssh-connection-wake-retry.test.ts b/src/main/ssh/connection/ssh-connection-wake-retry.test.ts index d00bc4305a7..cd2858d5801 100644 --- a/src/main/ssh/connection/ssh-connection-wake-retry.test.ts +++ b/src/main/ssh/connection/ssh-connection-wake-retry.test.ts @@ -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 { describe('SshConnection retry after wake or network return', () => { beforeEach(() => { resetSshConnectionMocks() - resetSshUserDisconnectsForTests() vi.useFakeTimers() }) afterEach(() => { diff --git a/src/main/ssh/connection/testing/ssh-connection-test-harness.ts b/src/main/ssh/connection/testing/ssh-connection-test-harness.ts index 97897ebb59b..6805936f6d5 100644 --- a/src/main/ssh/connection/testing/ssh-connection-test-harness.ts +++ b/src/main/ssh/connection/testing/ssh-connection-test-harness.ts @@ -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()