test(agent): 执行边界 - 覆盖环境超时范围校验
This commit is contained in:
@@ -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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user