mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
* perf(worktree): remove redundant creation and terminal startup work * test(worktree): cover optimized creation call signatures Preserve explicit branch adoption, WSL callback routing and sparse cleanup expectations. * perf: preserve user Git checkout worker settings * perf(git): skip malformed remote base probes * perf(cli): avoid loading other agent hooks for Codex preflight * fix(build): retain Codex preflight entry for packaged CLI * test(ssh): wait for replacement PTY before lease recovery input * test(ssh): verify recovered shell execution and lease ownership * test(electron): reap isolated macOS crash reporters on teardown * test: allow either observed self-exit snapshot ordering * test: capture frozen-host input recovery evidence
46 lines
2.0 KiB
TypeScript
46 lines
2.0 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
import { execFileSync } from 'node:child_process'
|
|
import path from 'node:path'
|
|
import { cleanupE2ECrashpad } from './electron-crashpad-cleanup'
|
|
|
|
vi.mock('node:child_process', () => ({ execFileSync: vi.fn() }))
|
|
|
|
const profile = '/tmp/test profile'
|
|
const database = path.join(profile, 'Crashpad')
|
|
const reporter = `/Electron Framework/Helpers/chrome_crashpad_handler --database=${database} --annotation=prod=Electron`
|
|
|
|
afterEach(() => vi.restoreAllMocks())
|
|
|
|
describe('test-owned macOS Crashpad cleanup', () => {
|
|
it('terminates only the reporter for the exact temporary profile after rechecking ownership', () => {
|
|
vi.spyOn(process, 'platform', 'get').mockReturnValue('darwin')
|
|
const kill = vi.spyOn(process, 'kill').mockReturnValue(true)
|
|
vi.mocked(execFileSync)
|
|
.mockReturnValueOnce(
|
|
`111 ${reporter}\n222 ${reporter.replace('Crashpad ', 'Crashpad-old ')}\n333 ${reporter.replace('test profile', 'another profile')}\n444 /bin/echo --database=${database} \n`
|
|
)
|
|
.mockReturnValueOnce(reporter)
|
|
cleanupE2ECrashpad(profile)
|
|
expect(kill).toHaveBeenCalledExactlyOnceWith(111, 'SIGTERM')
|
|
expect(execFileSync).toHaveBeenLastCalledWith('ps', ['-p', '111', '-o', 'command='], {
|
|
encoding: 'utf8',
|
|
timeout: 5_000
|
|
})
|
|
})
|
|
|
|
it('does not signal a PID whose ownership changed after enumeration', () => {
|
|
vi.spyOn(process, 'platform', 'get').mockReturnValue('darwin')
|
|
const kill = vi.spyOn(process, 'kill').mockReturnValue(true)
|
|
vi.mocked(execFileSync).mockReturnValueOnce(`111 ${reporter}`).mockReturnValueOnce('/bin/sh')
|
|
cleanupE2ECrashpad(profile)
|
|
expect(kill).not.toHaveBeenCalled()
|
|
})
|
|
|
|
it.each(['win32', 'linux'] as const)('does not enumerate processes on %s', (platform) => {
|
|
vi.spyOn(process, 'platform', 'get').mockReturnValue(platform)
|
|
vi.mocked(execFileSync).mockClear()
|
|
cleanupE2ECrashpad(profile)
|
|
expect(execFileSync).not.toHaveBeenCalled()
|
|
})
|
|
})
|