mirror of
https://github.com/stablyai/orca.git
synced 2026-10-02 08:02:02 +00:00
test STA-5878 ownership and fence refusals
This commit is contained in:
@@ -60,4 +60,43 @@ describe('TerminalHost pending kill fences', () => {
|
||||
await host.dispose()
|
||||
}
|
||||
})
|
||||
|
||||
it('preserves a replacement session when a stale pending kill is fenced out', async () => {
|
||||
const subprocess: SubprocessHandle = {
|
||||
pid: 99999,
|
||||
getForegroundProcess: () => null,
|
||||
write: vi.fn(),
|
||||
resize: vi.fn(),
|
||||
kill: vi.fn(),
|
||||
forceKill: vi.fn(),
|
||||
terminateOwnedTree: () => 'unavailable',
|
||||
signal: vi.fn(),
|
||||
onData: vi.fn(),
|
||||
onExit: vi.fn(),
|
||||
dispose: vi.fn()
|
||||
}
|
||||
const host = new TerminalHost({ spawnSubprocess: () => subprocess })
|
||||
try {
|
||||
const replacement = await host.createOrAttach({
|
||||
sessionId: 'replacement-fence',
|
||||
cols: 80,
|
||||
rows: 24,
|
||||
streamClient: { onData: vi.fn(), onExit: vi.fn() }
|
||||
})
|
||||
await expect(
|
||||
host.kill('replacement-fence', {
|
||||
immediate: true,
|
||||
incarnationId: 'stale-incarnation'
|
||||
})
|
||||
).resolves.toEqual({ fenceUnavailable: true })
|
||||
expect(host.listSessions()).toEqual([
|
||||
expect.objectContaining({
|
||||
id: 'replacement-fence',
|
||||
incarnationId: replacement.incarnationId
|
||||
})
|
||||
])
|
||||
} finally {
|
||||
await host.dispose()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -91,7 +91,7 @@ describe('killPtySessions input bounds', () => {
|
||||
providerForSession: (id) => (id === 'failed' ? failed : healthy) as never,
|
||||
isOwned: () => ({ owned: false }),
|
||||
shutdown,
|
||||
ownershipUnavailable: (provider) => provider === failed
|
||||
ownershipUnavailable: (provider) => provider === (failed as never)
|
||||
})
|
||||
|
||||
expect(shutdown).toHaveBeenCalledTimes(1)
|
||||
|
||||
Reference in New Issue
Block a user