@@ -358,7 +358,7 @@ func TestValidateSchedule_ArgNotFixed(t *testing.T) {
358
358
},
359
359
}
360
360
t .Run ("with deprecated cron expression" , func (t * testing.T ) {
361
- request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * * * " )
361
+ request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * *" )
362
362
363
363
err := validateSchedule (request , inputMap )
364
364
assert .NotNil (t , err )
@@ -370,15 +370,15 @@ func TestValidateSchedule_ArgNotFixed(t *testing.T) {
370
370
assert .NotNil (t , err )
371
371
})
372
372
t .Run ("with cron schedule" , func (t * testing.T ) {
373
- request := testutils .GetLaunchPlanRequestWithCronSchedule ("* * * * * * " )
373
+ request := testutils .GetLaunchPlanRequestWithCronSchedule ("* * * * *" )
374
374
375
375
err := validateSchedule (request , inputMap )
376
376
assert .NotNil (t , err )
377
377
})
378
378
}
379
379
380
380
func TestValidateSchedule_KickoffTimeArgDoesNotExist (t * testing.T ) {
381
- request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * * * " )
381
+ request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * *" )
382
382
inputMap := & core.ParameterMap {
383
383
Parameters : map [string ]* core.Parameter {},
384
384
}
@@ -389,7 +389,7 @@ func TestValidateSchedule_KickoffTimeArgDoesNotExist(t *testing.T) {
389
389
}
390
390
391
391
func TestValidateSchedule_KickoffTimeArgPointsAtWrongType (t * testing.T ) {
392
- request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * * * " )
392
+ request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * *" )
393
393
inputMap := & core.ParameterMap {
394
394
Parameters : map [string ]* core.Parameter {
395
395
foo : {
@@ -409,7 +409,7 @@ func TestValidateSchedule_KickoffTimeArgPointsAtWrongType(t *testing.T) {
409
409
}
410
410
411
411
func TestValidateSchedule_NoRequired (t * testing.T ) {
412
- request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * * * " )
412
+ request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * *" )
413
413
inputMap := & core.ParameterMap {
414
414
Parameters : map [string ]* core.Parameter {
415
415
foo : {
@@ -428,7 +428,7 @@ func TestValidateSchedule_NoRequired(t *testing.T) {
428
428
}
429
429
430
430
func TestValidateSchedule_KickoffTimeBound (t * testing.T ) {
431
- request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * * * " )
431
+ request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * *" )
432
432
inputMap := & core.ParameterMap {
433
433
Parameters : map [string ]* core.Parameter {
434
434
foo : {
@@ -446,3 +446,34 @@ func TestValidateSchedule_KickoffTimeBound(t *testing.T) {
446
446
err := validateSchedule (request , inputMap )
447
447
assert .Nil (t , err )
448
448
}
449
+
450
+ func TestValidateSchedule_InvalidCronExpression (t * testing.T ) {
451
+ inputMap := & core.ParameterMap {
452
+ Parameters : map [string ]* core.Parameter {
453
+ foo : {
454
+ Var : & core.Variable {
455
+ Type : & core.LiteralType {Type : & core.LiteralType_Simple {Simple : core .SimpleType_DATETIME }},
456
+ },
457
+ Behavior : & core.Parameter_Required {
458
+ Required : true ,
459
+ },
460
+ },
461
+ },
462
+ }
463
+
464
+ t .Run ("with unsupported cron special characters on deprecated cron schedule: #" , func (t * testing.T ) {
465
+ request := testutils .GetLaunchPlanRequestWithDeprecatedCronSchedule ("* * * * MON#1" )
466
+ request .Spec .EntityMetadata .Schedule .KickoffTimeInputArg = foo
467
+
468
+ err := validateSchedule (request , inputMap )
469
+ assert .NotNil (t , err )
470
+ })
471
+
472
+ t .Run ("with unsupported cron special characters: #" , func (t * testing.T ) {
473
+ request := testutils .GetLaunchPlanRequestWithCronSchedule ("* * * * MON#1" )
474
+ request .Spec .EntityMetadata .Schedule .KickoffTimeInputArg = foo
475
+
476
+ err := validateSchedule (request , inputMap )
477
+ assert .NotNil (t , err )
478
+ })
479
+ }
0 commit comments