Skip to content

test: cover selectPoolSandbox empty-pod-list branch - #70

Merged
pdettori merged 1 commit into
mainfrom
test/select-pool-sandbox-empty-list-56
Jul 7, 2026
Merged

pdettori merged 1 commit into
mainfrom
test/select-pool-sandbox-empty-list-56

Conversation

@pdettori

@pdettori pdettori commented Jul 7, 2026

Copy link
Copy Markdown
Member

Closes #56.

Follow-up from P2 (#46, PR #53).

harness/src/select-sandbox.ts throws a plain Error("no Running pods for pool selector ...") when a pool selector is configured but listPoolPods returns an empty list. This branch was previously untested — the existing null-return test passes an empty list only through the no-selector fallback path (returning null) and never reaches the guard on line 59.

Change

Add one unit test to harness/test/select-sandbox.test.ts that:

  • sets KAGENTI_SANDBOX_POOL_SELECTOR and stubs listPods: async () => []
  • asserts the rejection is a plain Error
  • asserts it is distinct from SandboxPoolSaturatedError
  • asserts the exact message no Running pods for pool selector 'app=sandbox'

The exact-message assertion also serves as the branch guard: nothing else in the module emits that string, so a pass proves the empty-list branch executed.

Verification

  • vitest run test/select-sandbox.test.ts → 6 passed (5 existing + new)
  • tsc --noEmit typecheck → clean

No dependency or source changes; test-only.

Assisted-By: Claude Code

Add a unit test for the branch in select-sandbox.ts that throws a plain
Error("no Running pods for pool selector ...") when a pool selector is
configured but listPoolPods returns an empty list. This branch was
previously untested: the existing null-return test passes an empty list
only through the no-selector fallback path and never reaches the guard.

The test asserts the rejection is a plain Error, is distinct from
SandboxPoolSaturatedError, and carries the exact message.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit ff49557 into main Jul 7, 2026
9 checks passed
@pdettori
pdettori deleted the test/select-pool-sandbox-empty-list-56 branch October 27, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit test for selectPoolSandbox empty-pod-list branch

1 participant