mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 02:17:31 +00:00
Remove 129 low-value test cases and 45 whole suites (#38233)
* Remove low-value renderer and main tests 129 registrations removed; 45 whole suites deleted. * Clean deleted-suite CI reference and retained type import --------- Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
@@ -46,39 +46,6 @@ describe('tracked gh capture lifetime', () => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it.each([false, true])(
|
||||
'keeps grace settlement separate from termination (abort: %s)',
|
||||
async (abort) => {
|
||||
const value = child(1234)
|
||||
spawnMock.mockReturnValue(value)
|
||||
const owner = createGhLogicalLifetime()
|
||||
const controller = new AbortController()
|
||||
const result = ghExecFileAsync(
|
||||
['api', 'user'],
|
||||
{ timeout: 10, ...(abort ? { signal: controller.signal } : {}) },
|
||||
owner.hooks
|
||||
)
|
||||
const rejection = expect(result).rejects.toThrow()
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
if (abort) {
|
||||
controller.abort('private-reason')
|
||||
}
|
||||
await vi.advanceTimersByTimeAsync(12_010)
|
||||
await rejection
|
||||
owner.seal()
|
||||
let terminated = false
|
||||
void owner.terminated.then(() => {
|
||||
terminated = true
|
||||
})
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
expect(terminated).toBe(false)
|
||||
expect(spawnMock).toHaveBeenCalledOnce()
|
||||
value.emit('close', null, 'SIGKILL')
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
expect(terminated).toBe(true)
|
||||
}
|
||||
)
|
||||
|
||||
it('waits for a PID error close before retry and ignores its stale callback', async () => {
|
||||
const values = [child(11), child(12)]
|
||||
spawnMock.mockReturnValueOnce(values[0]).mockReturnValueOnce(values[1])
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
import { chmod, mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { gitExecFileAsync, gitExecFileAsyncBuffer } from './git-exec-file'
|
||||
import { GitCommandTimeoutError } from '../../../shared/git/commands/git-command-timeout'
|
||||
import { gitStreamStdout } from './git-stream-stdout'
|
||||
|
||||
const tempRoots: string[] = []
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(tempRoots.splice(0).map((root) => rm(root, { recursive: true, force: true })))
|
||||
})
|
||||
|
||||
async function createTimedGitFixture(): Promise<{
|
||||
cwd: string
|
||||
env: NodeJS.ProcessEnv
|
||||
}> {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'orca-git-timeout-'))
|
||||
tempRoots.push(root)
|
||||
const binDir = path.join(root, 'bin')
|
||||
const cwd = path.join(root, 'repo')
|
||||
await mkdir(binDir)
|
||||
await mkdir(cwd)
|
||||
const script = path.join(binDir, 'git')
|
||||
await writeFile(
|
||||
script,
|
||||
`#!/usr/bin/env node
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
||||
async function run() {
|
||||
if (process.env.ORCA_STUB_PROGRESSIVE === '1') {
|
||||
const remaining = Math.max(0, Number(process.env.ORCA_STUB_EXIT_AT_MS) - Date.now())
|
||||
const step = remaining / 3
|
||||
await sleep(step)
|
||||
process.stdout.write('one')
|
||||
await sleep(step)
|
||||
process.stdout.write('two')
|
||||
await sleep(step)
|
||||
process.stdout.write('three')
|
||||
return
|
||||
}
|
||||
await sleep(Number(process.env.ORCA_STUB_SLEEP_MS))
|
||||
process.stdout.write('done')
|
||||
}
|
||||
void run()
|
||||
`
|
||||
)
|
||||
await chmod(script, 0o755)
|
||||
return {
|
||||
cwd,
|
||||
env: { ...process.env, PATH: `${binDir}${path.delimiter}${process.env.PATH ?? ''}` }
|
||||
}
|
||||
}
|
||||
|
||||
describe.skipIf(process.platform === 'win32')('git read timeout behavior', () => {
|
||||
it('rejects a silent read at 1.1 times the deadline with a typed error', async () => {
|
||||
const fixture = await createTimedGitFixture()
|
||||
await expect(
|
||||
gitExecFileAsync(['status', '--porcelain=v2'], {
|
||||
...fixture,
|
||||
env: { ...fixture.env, ORCA_STUB_SLEEP_MS: '110' },
|
||||
timeoutMsForTest: 100
|
||||
})
|
||||
).rejects.toBeInstanceOf(GitCommandTimeoutError)
|
||||
})
|
||||
|
||||
it('times out a silent streaming read with the same typed error', async () => {
|
||||
const fixture = await createTimedGitFixture()
|
||||
await expect(
|
||||
gitStreamStdout(['status'], {
|
||||
...fixture,
|
||||
env: { ...fixture.env, ORCA_STUB_SLEEP_MS: '110' },
|
||||
timeoutMsForTest: 100,
|
||||
onStdout: () => {}
|
||||
})
|
||||
).rejects.toBeInstanceOf(GitCommandTimeoutError)
|
||||
})
|
||||
|
||||
it('applies the read default to binary blob reads', async () => {
|
||||
const fixture = await createTimedGitFixture()
|
||||
await expect(
|
||||
gitExecFileAsyncBuffer(['show', 'HEAD:file.bin'], {
|
||||
...fixture,
|
||||
env: { ...fixture.env, ORCA_STUB_SLEEP_MS: '110' },
|
||||
timeoutMsForTest: 100
|
||||
})
|
||||
).rejects.toBeInstanceOf(GitCommandTimeoutError)
|
||||
})
|
||||
|
||||
it.each([['fetch'], ['checkout'], ['unrecognized-command']])(
|
||||
'does not default-timeout the fail-safe %s class',
|
||||
async (subcommand) => {
|
||||
const fixture = await createTimedGitFixture()
|
||||
await expect(
|
||||
gitExecFileAsync([subcommand], {
|
||||
...fixture,
|
||||
env: { ...fixture.env, ORCA_STUB_SLEEP_MS: '110' },
|
||||
timeoutMsForTest: 100
|
||||
})
|
||||
).resolves.toMatchObject({ stdout: 'done' })
|
||||
}
|
||||
)
|
||||
})
|
||||
@@ -1,11 +1,7 @@
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { resolveGitAdmissionTier } from './git-operation-executor'
|
||||
import {
|
||||
acquireGitAdmission,
|
||||
_resetGitAdmissionForTests,
|
||||
_gitAdmissionSnapshotForTests
|
||||
} from './git-subprocess-admission'
|
||||
import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler'
|
||||
import { _resetGitAdmissionForTests } from './git-subprocess-admission'
|
||||
|
||||
import {
|
||||
worktreeCreateGit,
|
||||
worktreePreparationGit
|
||||
@@ -34,44 +30,4 @@ describe('Git operation execution policy', () => {
|
||||
await create
|
||||
expect(resolveGitAdmissionTier()).toBe('status')
|
||||
})
|
||||
|
||||
it.each([false, true])(
|
||||
'expires inherited policy after completion (failure: %s)',
|
||||
async (fail) => {
|
||||
const finishDetached = Promise.withResolvers<void>()
|
||||
let detached: Promise<string> | undefined
|
||||
const create = worktreeCreateGit.run(async () => {
|
||||
detached = finishDetached.promise.then(() => resolveGitAdmissionTier())
|
||||
if (fail) {
|
||||
throw new Error('create failed')
|
||||
}
|
||||
})
|
||||
await (fail ? expect(create).rejects.toThrow('create failed') : create)
|
||||
finishDetached.resolve()
|
||||
await expect(detached).resolves.toBe('status')
|
||||
}
|
||||
)
|
||||
|
||||
it('admits nested commands without priority options while preparation work stays queued', async () => {
|
||||
_resetGitAdmissionForTests(new GitAdmissionScheduler({ generalCap: 1, generalHeadroom: 1 }))
|
||||
const blocker = await acquireGitAdmission({ args: ['status'], cwd: '/repo' })
|
||||
const preparation = worktreePreparationGit.run(() =>
|
||||
acquireGitAdmission({ args: ['status'], cwd: '/repo' })
|
||||
)
|
||||
try {
|
||||
await worktreeCreateGit.run(async () => {
|
||||
const grant = await acquireGitAdmission({ args: ['rev-parse', 'HEAD'], cwd: '/repo' })
|
||||
expect(_gitAdmissionSnapshotForTests()).toMatchObject({
|
||||
queued: 1,
|
||||
budgets: { general: { baseUsed: 1, headroomUsed: 1 } }
|
||||
})
|
||||
grant.release()
|
||||
})
|
||||
} finally {
|
||||
blocker.release()
|
||||
const grant = await preparation
|
||||
grant.release()
|
||||
}
|
||||
expect(_gitAdmissionSnapshotForTests().queued).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user