MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestBashCustomTimeoutHonored

Function TestBashCustomTimeoutHonored

internal/tools/bash_test.go:127–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

125}
126
127func TestBashCustomTimeoutHonored(t *testing.T) {
128 // timeout_seconds of 1 truncates the 3s sleep, and flows through to Bash.
129 start := time.Now()
130 call := chmctx.ToolCall{
131 ID: "t1", Name: "bash",
132 Arguments: map[string]any{
133 "cmd": "sleep 3",
134 "timeout_seconds": float64(1),
135 },
136 }
137 msg := Execute(context.Background(), call)
138 if elapsed := time.Since(start); elapsed > 2*time.Second {
139 t.Fatalf("custom timeout ignored; elapsed %s", elapsed)
140 }
141 if !strings.Contains(msg.Content, "timeout") {
142 t.Fatalf("expected timeout marker: %q", msg.Content)
143 }
144}
145
146func TestBashTimeoutCappedAtOneHour(t *testing.T) {
147 // 999999s must clamp to 3600. Can't sleep an hour to prove it, so a short

Callers

nothing calls this directly

Calls 1

ExecuteFunction · 0.85

Tested by

no test coverage detected