@@ -205,15 +205,15 @@ func TestWorkspaceUpdateAutostart(t *testing.T) {
205
205
},
206
206
{
207
207
name :"friday to monday" ,
208
- schedule :"CRON_TZ=Europe/Dublin 30 9 1-5" ,
208
+ schedule :"CRON_TZ=Europe/Dublin 30 9* * 1-5" ,
209
209
expectedError :"" ,
210
210
at :time .Date (2022 ,5 ,6 ,9 ,31 ,0 ,0 ,dublinLoc ),
211
211
expectedNext :time .Date (2022 ,5 ,9 ,9 ,30 ,0 ,0 ,dublinLoc ),
212
212
expectedInterval :71 * time .Hour + 59 * time .Minute ,
213
213
},
214
214
{
215
215
name :"monday to tuesday" ,
216
- schedule :"CRON_TZ=Europe/Dublin 30 9 1-5" ,
216
+ schedule :"CRON_TZ=Europe/Dublin 30 9* * 1-5" ,
217
217
expectedError :"" ,
218
218
at :time .Date (2022 ,5 ,9 ,9 ,31 ,0 ,0 ,dublinLoc ),
219
219
expectedNext :time .Date (2022 ,5 ,10 ,9 ,30 ,0 ,0 ,dublinLoc ),
@@ -222,7 +222,7 @@ func TestWorkspaceUpdateAutostart(t *testing.T) {
222
222
{
223
223
// DST in Ireland began on Mar 27 in 2022 at 0100. Forward 1 hour.
224
224
name :"DST start" ,
225
- schedule :"CRON_TZ=Europe/Dublin 30 9 *" ,
225
+ schedule :"CRON_TZ=Europe/Dublin 30 9 * * * " ,
226
226
expectedError :"" ,
227
227
at :time .Date (2022 ,3 ,26 ,9 ,31 ,0 ,0 ,dublinLoc ),
228
228
expectedNext :time .Date (2022 ,3 ,27 ,9 ,30 ,0 ,0 ,dublinLoc ),
@@ -231,21 +231,26 @@ func TestWorkspaceUpdateAutostart(t *testing.T) {
231
231
{
232
232
// DST in Ireland ends on Oct 30 in 2022 at 0200. Back 1 hour.
233
233
name :"DST end" ,
234
- schedule :"CRON_TZ=Europe/Dublin 30 9 *" ,
234
+ schedule :"CRON_TZ=Europe/Dublin 30 9 * * * " ,
235
235
expectedError :"" ,
236
236
at :time .Date (2022 ,10 ,29 ,9 ,31 ,0 ,0 ,dublinLoc ),
237
237
expectedNext :time .Date (2022 ,10 ,30 ,9 ,30 ,0 ,0 ,dublinLoc ),
238
238
expectedInterval :24 * time .Hour + 59 * time .Minute ,
239
239
},
240
240
{
241
241
name :"invalid location" ,
242
- schedule :"CRON_TZ=Imaginary/Place 30 9 1-5" ,
242
+ schedule :"CRON_TZ=Imaginary/Place 30 9* * 1-5" ,
243
243
expectedError :"status code 500: invalid autostart schedule: parse schedule: provided bad location Imaginary/Place: unknown time zone Imaginary/Place" ,
244
244
},
245
245
{
246
246
name :"invalid schedule" ,
247
247
schedule :"asdf asdf asdf " ,
248
- expectedError :`status code 500: invalid autostart schedule: parse schedule: failed to parse int from asdf: strconv.Atoi: parsing "asdf": invalid syntax` ,
248
+ expectedError :`status code 500: invalid autostart schedule: validate weekly schedule: expected schedule to consist of 5 fields with an optional CRON_TZ=<timezone> prefix` ,
249
+ },
250
+ {
251
+ name :"only 3 values" ,
252
+ schedule :"CRON_TZ=Europe/Dublin 30 9 *" ,
253
+ expectedError :`status code 500: invalid autostart schedule: validate weekly schedule: expected schedule to consist of 5 fields with an optional CRON_TZ=<timezone> prefix` ,
249
254
},
250
255
}
251
256
@@ -334,15 +339,15 @@ func TestWorkspaceUpdateAutostop(t *testing.T) {
334
339
},
335
340
{
336
341
name :"friday to monday" ,
337
- schedule :"CRON_TZ=Europe/Dublin 30 17 1-5" ,
342
+ schedule :"CRON_TZ=Europe/Dublin 30 17* * 1-5" ,
338
343
expectedError :"" ,
339
344
at :time .Date (2022 ,5 ,6 ,17 ,31 ,0 ,0 ,dublinLoc ),
340
345
expectedNext :time .Date (2022 ,5 ,9 ,17 ,30 ,0 ,0 ,dublinLoc ),
341
346
expectedInterval :71 * time .Hour + 59 * time .Minute ,
342
347
},
343
348
{
344
349
name :"monday to tuesday" ,
345
- schedule :"CRON_TZ=Europe/Dublin 30 17 1-5" ,
350
+ schedule :"CRON_TZ=Europe/Dublin 30 17* * 1-5" ,
346
351
expectedError :"" ,
347
352
at :time .Date (2022 ,5 ,9 ,17 ,31 ,0 ,0 ,dublinLoc ),
348
353
expectedNext :time .Date (2022 ,5 ,10 ,17 ,30 ,0 ,0 ,dublinLoc ),
@@ -351,7 +356,7 @@ func TestWorkspaceUpdateAutostop(t *testing.T) {
351
356
{
352
357
// DST in Ireland began on Mar 27 in 2022 at 0100. Forward 1 hour.
353
358
name :"DST start" ,
354
- schedule :"CRON_TZ=Europe/Dublin 30 17 *" ,
359
+ schedule :"CRON_TZ=Europe/Dublin 30 17 * * * " ,
355
360
expectedError :"" ,
356
361
at :time .Date (2022 ,3 ,26 ,17 ,31 ,0 ,0 ,dublinLoc ),
357
362
expectedNext :time .Date (2022 ,3 ,27 ,17 ,30 ,0 ,0 ,dublinLoc ),
@@ -360,21 +365,26 @@ func TestWorkspaceUpdateAutostop(t *testing.T) {
360
365
{
361
366
// DST in Ireland ends on Oct 30 in 2022 at 0200. Back 1 hour.
362
367
name :"DST end" ,
363
- schedule :"CRON_TZ=Europe/Dublin 30 17 *" ,
368
+ schedule :"CRON_TZ=Europe/Dublin 30 17 * * * " ,
364
369
expectedError :"" ,
365
370
at :time .Date (2022 ,10 ,29 ,17 ,31 ,0 ,0 ,dublinLoc ),
366
371
expectedNext :time .Date (2022 ,10 ,30 ,17 ,30 ,0 ,0 ,dublinLoc ),
367
372
expectedInterval :24 * time .Hour + 59 * time .Minute ,
368
373
},
369
374
{
370
375
name :"invalid location" ,
371
- schedule :"CRON_TZ=Imaginary/Place 30 17 1-5" ,
376
+ schedule :"CRON_TZ=Imaginary/Place 30 17* * 1-5" ,
372
377
expectedError :"status code 500: invalid autostop schedule: parse schedule: provided bad location Imaginary/Place: unknown time zone Imaginary/Place" ,
373
378
},
374
379
{
375
380
name :"invalid schedule" ,
376
381
schedule :"asdf asdf asdf " ,
377
- expectedError :`status code 500: invalid autostop schedule: parse schedule: failed to parse int from asdf: strconv.Atoi: parsing "asdf": invalid syntax` ,
382
+ expectedError :`status code 500: invalid autostop schedule: validate weekly schedule: expected schedule to consist of 5 fields with an optional CRON_TZ=<timezone> prefix` ,
383
+ },
384
+ {
385
+ name :"only 3 values" ,
386
+ schedule :"CRON_TZ=Europe/Dublin 30 9 *" ,
387
+ expectedError :`status code 500: invalid autostop schedule: validate weekly schedule: expected schedule to consist of 5 fields with an optional CRON_TZ=<timezone> prefix` ,
378
388
},
379
389
}
380
390