Files
orca/src/shared/orchestration-ask-timeout.test.ts
T
Jinjing 76b2a3b44d fix(cli): bound orchestration ask timeouts (#10689)
* fix(cli): bound orchestration ask timeouts

* fix(cli): harden remote timeout boundaries
2026-07-26 12:50:05 -07:00

28 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
clampOrchestrationAskTimeoutMs,
ORCHESTRATION_ASK_DEFAULT_TIMEOUT_MS,
ORCHESTRATION_ASK_MAX_TIMEOUT_MS,
resolveOrchestrationAskClientTimeoutMs
} from './orchestration-ask-timeout'
import { MAX_TIMER_DELAY_MS } from './timer-delay'
describe('orchestration ask timeout policy', () => {
it('defaults and clamps to the shared server maximum', () => {
expect(clampOrchestrationAskTimeoutMs(undefined)).toBe(ORCHESTRATION_ASK_DEFAULT_TIMEOUT_MS)
expect(clampOrchestrationAskTimeoutMs(1_000)).toBe(1_000)
expect(clampOrchestrationAskTimeoutMs(ORCHESTRATION_ASK_MAX_TIMEOUT_MS)).toBe(
ORCHESTRATION_ASK_MAX_TIMEOUT_MS
)
expect(clampOrchestrationAskTimeoutMs(Number.MAX_SAFE_INTEGER)).toBe(
ORCHESTRATION_ASK_MAX_TIMEOUT_MS
)
expect(clampOrchestrationAskTimeoutMs(-5)).toBe(0)
})
it('leaves room for the longest outer ask transport grace', () => {
expect(resolveOrchestrationAskClientTimeoutMs(ORCHESTRATION_ASK_MAX_TIMEOUT_MS)).toBe(1_805_000)
expect(ORCHESTRATION_ASK_MAX_TIMEOUT_MS + 3 * 60_000).toBeLessThan(MAX_TIMER_DELAY_MS)
})
})