(t *testing.T)
| 1169 | } |
| 1170 | |
| 1171 | func TestMatchesCron(t *testing.T) { |
| 1172 | t.Parallel() |
| 1173 | testCases := []struct { |
| 1174 | name string |
| 1175 | spec string |
| 1176 | at time.Time |
| 1177 | expectedMatches bool |
| 1178 | }{ |
| 1179 | // A comprehensive test suite for time range evaluation is implemented in TestIsWithinRange. |
| 1180 | // This test provides only basic coverage. |
| 1181 | { |
| 1182 | name: "Right before the start of the time range", |
| 1183 | spec: "* 9-18 * * 1-5", |
| 1184 | at: mustParseTime(t, time.RFC1123, "Mon, 02 Jun 2025 8:59:59 UTC"), |
| 1185 | expectedMatches: false, |
| 1186 | }, |
| 1187 | { |
| 1188 | name: "Start of the time range", |
| 1189 | spec: "* 9-18 * * 1-5", |
| 1190 | at: mustParseTime(t, time.RFC1123, "Mon, 02 Jun 2025 9:00:00 UTC"), |
| 1191 | expectedMatches: true, |
| 1192 | }, |
| 1193 | } |
| 1194 | |
| 1195 | for _, testCase := range testCases { |
| 1196 | t.Run(testCase.name, func(t *testing.T) { |
| 1197 | t.Parallel() |
| 1198 | |
| 1199 | matches, err := prebuilds.MatchesCron(testCase.spec, testCase.at) |
| 1200 | require.NoError(t, err) |
| 1201 | require.Equal(t, testCase.expectedMatches, matches) |
| 1202 | }) |
| 1203 | } |
| 1204 | } |
| 1205 | |
| 1206 | func TestCalculateDesiredInstances(t *testing.T) { |
| 1207 | t.Parallel() |
nothing calls this directly
no test coverage detected