MCPcopy Create free account
hub / github.com/commander-cli/commander / Test_RuntimeWithRetriesAndInterval

Function Test_RuntimeWithRetriesAndInterval

pkg/runtime/runtime_test.go:71–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func Test_RuntimeWithRetriesAndInterval(t *testing.T) {
72 s := getExampleTestCases()
73 s[0].Command.Retries = 3
74 s[0].Command.Cmd = "echo fail"
75 s[0].Command.Interval = "50ms"
76
77 start := time.Now()
78 r := getRuntime()
79 got := r.Start(s)
80
81 var counter = 0
82 for _, r := range got.TestResults {
83 counter++
84 assert.False(t, r.ValidationResult.Success)
85 assert.Equal(t, 3, r.Tries)
86 }
87 duration := time.Since(start)
88
89 assert.Equal(t, 1, counter)
90 assert.True(t, duration.Seconds() > 0.15, "Retry interval did not work")
91}
92
93func Test_RuntimeWithSkip(t *testing.T) {
94 s := getExampleTestCases()

Callers

nothing calls this directly

Calls 3

getExampleTestCasesFunction · 0.85
getRuntimeFunction · 0.85
StartMethod · 0.80

Tested by

no test coverage detected