test(agent): 执行边界 - 覆盖环境超时范围校验

This commit is contained in:
ddCat
2026-09-22 11:59:14 +08:00
parent 2af633caec
commit f4e5c73eb2

View File

@@ -0,0 +1,19 @@
package platform
import "testing"
func TestAgentStepTimeoutEnvironmentBounds(t *testing.T) {
for _, tc := range []struct {
value string
want int
}{
{"-1", 0}, {"0", 0}, {"1", 30}, {"29", 30}, {"30", 30}, {"90", 90}, {"3601", 3600},
} {
t.Run(tc.value, func(t *testing.T) {
t.Setenv("CANVAS_AGENT_STEP_TIMEOUT_SECONDS", tc.value)
if got := agentStepTimeoutSecondsDefault(); got != tc.want {
t.Fatalf("timeout = %d, want %d", got, tc.want)
}
})
}
}