MCPcopy Index your code
hub / github.com/coder/coder / TestGetProgressiveInterval

Function TestGetProgressiveInterval

cli/cliui/agent_test.go:1015–1041  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1013}
1014
1015func TestGetProgressiveInterval(t *testing.T) {
1016 t.Parallel()
1017
1018 baseInterval := 500 * time.Millisecond
1019
1020 testCases := []struct {
1021 name string
1022 elapsed time.Duration
1023 expected time.Duration
1024 }{
1025 {"first_minute", 30 * time.Second, baseInterval},
1026 {"second_minute", 90 * time.Second, baseInterval * 2},
1027 {"third_to_fifth_minute", 3 * time.Minute, baseInterval * 4},
1028 {"sixth_to_tenth_minute", 7 * time.Minute, baseInterval * 8},
1029 {"after_ten_minutes", 15 * time.Minute, baseInterval * 16},
1030 {"boundary_first_minute", 59 * time.Second, baseInterval},
1031 {"boundary_second_minute", 61 * time.Second, baseInterval * 2},
1032 }
1033
1034 for _, tc := range testCases {
1035 t.Run(tc.name, func(t *testing.T) {
1036 t.Parallel()
1037 result := cliui.GetProgressiveInterval(baseInterval, tc.elapsed)
1038 require.Equal(t, tc.expected, result)
1039 })
1040 }
1041}

Callers

nothing calls this directly

Calls 3

GetProgressiveIntervalFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected