mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
Keep example shell regression while removing obsolete observer tests
This commit is contained in:
@@ -19,91 +19,6 @@ describe('orchestration setup completion signal', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it.skipIf(process.platform === 'win32')(
|
||||
'observes the exact sequenced Setup invocation once and keeps its failure result',
|
||||
async () => {
|
||||
const { mkdtempSync, readFileSync, rmSync, writeFileSync } = await import('node:fs')
|
||||
const { tmpdir } = await import('node:os')
|
||||
const { join } = await import('node:path')
|
||||
const { runProcessSync } = await import('@orca/process-host')
|
||||
const { createSequencedSetupAgentCommands } =
|
||||
await import('../../../../../shared/agent-launch/startup/setup-agent-sequencing')
|
||||
const { buildObservedSetupCommand } = await import('./setup-completion-signal')
|
||||
const root = mkdtempSync(join(tmpdir(), 'orca-observed-sequence-'))
|
||||
const runner = join(root, 'setup.sh')
|
||||
try {
|
||||
writeFileSync(runner, 'printf x >> "$RUN_RECEIPT"\nexit 17\n')
|
||||
const sequence = createSequencedSetupAgentCommands({
|
||||
runnerScriptPath: runner,
|
||||
startupCommand: 'codex',
|
||||
platform: 'posix',
|
||||
nonce: 'once'
|
||||
})
|
||||
const observed = buildObservedSetupCommand(
|
||||
runner,
|
||||
'posix',
|
||||
'token-exact',
|
||||
undefined,
|
||||
sequence.setupCommand
|
||||
)
|
||||
const result = runProcessSync({
|
||||
program: 'bash',
|
||||
args: ['-c', observed.command],
|
||||
env: {
|
||||
...process.env,
|
||||
...sequence.setupEnv,
|
||||
...observed.env,
|
||||
RUN_RECEIPT: join(root, 'ran')
|
||||
}
|
||||
})
|
||||
expect(result.code).toBe(17)
|
||||
expect(readFileSync(join(root, 'ran'), 'utf8')).toBe('x')
|
||||
expect(readFileSync(`${runner}.once.done`, 'utf8')).toBe('once:17\n')
|
||||
const completed = vi.fn()
|
||||
createSetupCompletionScanner('token-exact', completed).scan(result.stdout ?? '')
|
||||
expect(completed).toHaveBeenCalledExactlyOnceWith(17)
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
it('keeps deep Windows sequenced invocations out of the typed observer payload', async () => {
|
||||
const { createSequencedSetupAgentCommands } =
|
||||
await import('../../../../../shared/agent-launch/startup/setup-agent-sequencing')
|
||||
const { buildObservedSetupCommand } = await import('./setup-completion-signal')
|
||||
const runner = `C:\\${'deep path\\'.repeat(80)}setup.cmd`
|
||||
const sequence = createSequencedSetupAgentCommands({
|
||||
runnerScriptPath: runner,
|
||||
startupCommand: 'codex',
|
||||
platform: 'windows'
|
||||
})
|
||||
const observed = buildObservedSetupCommand(
|
||||
runner,
|
||||
'windows',
|
||||
'token-windows',
|
||||
{ family: 'cmd' },
|
||||
sequence.setupCommand
|
||||
)
|
||||
expect(observed.env?.ORCA_OBSERVED_SETUP_COMMAND).toBe(sequence.setupCommand)
|
||||
expect(observed.command.length).toBeLessThan(1800)
|
||||
const gitBash = createSequencedSetupAgentCommands({
|
||||
runnerScriptPath: runner,
|
||||
startupCommand: 'codex',
|
||||
platform: 'windows',
|
||||
shell: { family: 'posix' }
|
||||
})
|
||||
const posixObserved = buildObservedSetupCommand(
|
||||
runner,
|
||||
'windows',
|
||||
'token-gitbash',
|
||||
{ family: 'posix' },
|
||||
gitBash.setupCommand
|
||||
)
|
||||
expect(posixObserved.command).toMatch(/^bash -lc /)
|
||||
expect(posixObserved.command.length).toBeLessThan(1000)
|
||||
})
|
||||
|
||||
it.skipIf(process.platform === 'win32')(
|
||||
'runs the generated POSIX example with the owning managed CLI name and quoted arguments',
|
||||
async () => {
|
||||
|
||||
Reference in New Issue
Block a user