Skip to content

Commit 6dd305f

Browse files
committed
test(cli): make timeout fixture fast and deterministic
1 parent f8f4ed3 commit 6dd305f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/test/java/io/github/easy4j/codex/cli/CodexCliExecutorTest.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,14 @@ void shouldUseDedicatedProbeTimeoutWithoutChangingNormalTimeout() {
182182

183183
@Test
184184
void shouldTimeoutOnHangingProcess() {
185-
// Use a short timeout and a command that sleeps for a long time.
186-
CodexClientConfig config = configFor("/bin/sh");
185+
// Keep the blocking loop in the shell process itself so killing the
186+
// shell closes stdout/stderr immediately; a spawned sleep child would
187+
// keep inherited pipes open and make the test wait for the child.
188+
CodexClientConfig config = configFor("/bin/sh " + SLOW_CODEX_SCRIPT);
187189
config.setLocalTimeoutSeconds(1);
188190
CodexCliExecutor executor = new CodexCliExecutor(config);
189191

190-
CodexCliResult result = executor.execute("-c", "sleep 60");
192+
CodexCliResult result = executor.execute();
191193

192194
// On macOS/Linux the watchdog kills the process; the exit code is -1
193195
// and stderr contains the timeout notice.

0 commit comments

Comments
 (0)