diff --git a/flyteadmin/pkg/manager/impl/validation/launch_plan_validator.go b/flyteadmin/pkg/manager/impl/validation/launch_plan_validator.go index 357c3c1e4e..732c00666a 100644 --- a/flyteadmin/pkg/manager/impl/validation/launch_plan_validator.go +++ b/flyteadmin/pkg/manager/impl/validation/launch_plan_validator.go @@ -66,7 +66,7 @@ func ValidateLaunchPlan(ctx context.Context, func validateSchedule(request admin.LaunchPlanCreateRequest, expectedInputs *core.ParameterMap) error { schedule := request.GetSpec().GetEntityMetadata().GetSchedule() - if schedule.GetCronExpression() != "" || schedule.GetRate() != nil { + if schedule.GetCronExpression() != "" || schedule.GetRate() != nil || schedule.GetCronSchedule() != nil { for key, value := range expectedInputs.Parameters { if value.GetRequired() && key != schedule.GetKickoffTimeInputArg() { return errors.NewFlyteAdminErrorf( diff --git a/flyteadmin/pkg/manager/impl/validation/launch_plan_validator_test.go b/flyteadmin/pkg/manager/impl/validation/launch_plan_validator_test.go index a2d27c3c6c..8c2c768d42 100644 --- a/flyteadmin/pkg/manager/impl/validation/launch_plan_validator_test.go +++ b/flyteadmin/pkg/manager/impl/validation/launch_plan_validator_test.go @@ -297,7 +297,6 @@ func TestValidateSchedule_NoSchedule(t *testing.T) { } func TestValidateSchedule_ArgNotFixed(t *testing.T) { - request := testutils.GetLaunchPlanRequestWithDeprecatedCronSchedule("* * * * * *") inputMap := &core.ParameterMap{ Parameters: map[string]*core.Parameter{ "foo": { @@ -310,9 +309,24 @@ func TestValidateSchedule_ArgNotFixed(t *testing.T) { }, }, } - - err := validateSchedule(request, inputMap) - assert.NotNil(t, err) + t.Run("with deprecated cron expression", func(t *testing.T) { + request := testutils.GetLaunchPlanRequestWithDeprecatedCronSchedule("* * * * * *") + + err := validateSchedule(request, inputMap) + assert.NotNil(t, err) + }) + t.Run("with rate", func(t *testing.T) { + request := testutils.GetLaunchPlanRequestWithFixedRateSchedule(2, admin.FixedRateUnit_HOUR) + + err := validateSchedule(request, inputMap) + assert.NotNil(t, err) + }) + t.Run("with cron schedule", func(t *testing.T) { + request := testutils.GetLaunchPlanRequestWithCronSchedule("* * * * * *") + + err := validateSchedule(request, inputMap) + assert.NotNil(t, err) + }) } func TestValidateSchedule_KickoffTimeArgDoesNotExist(t *testing.T) {