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:
Neil
2026-11-09 22:58:10 -08:00
parent 6863ef64dd
commit 219d9baf48
3 changed files with 5 additions and 7 deletions
@@ -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()