Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify unbounded inputs for all scheduled launch plan types #4867

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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) {
Expand Down
Loading