MCPcopy Create free account
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}
127
128func TestBashCustomTimeoutHonored(t *testing.T) {
129 // timeout_seconds of 1 truncates the 3s sleep, and flows through to Bash.
130 start := time.Now()
131 call := chmctx.ToolCall{
132 ID: "t1", Name: "bash",
133 Arguments: map[string]any{
134 "cmd": "sleep 3",
135 "timeout_seconds": float64(1),
136 },
137 }
138 msg := Execute(context.Background(), call)
139 if elapsed := time.Since(start); elapsed > 2*time.Second {
140 t.Fatalf("custom timeout ignored; elapsed %s", elapsed)
141 }
142 if !strings.Contains(msg.Content, "timeout") {
143 t.Fatalf("expected timeout marker: %q", msg.Content)
144 }
145}
146
147func TestBashTimeoutCappedAtOneHour(t *testing.T) {

Callers

nothing calls this directly

Calls 1

ExecuteFunction · 0.85

Tested by

no test coverage detected