From ebee55733d6a025b21d7f1909c8b52b07a079080 Mon Sep 17 00:00:00 2001 From: Thomas Newton Date: Wed, 27 Mar 2024 16:23:16 +0000 Subject: [PATCH] Add a test --- .../nodes/subworkflow/launchplan/admin_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flytepropeller/pkg/controller/nodes/subworkflow/launchplan/admin_test.go b/flytepropeller/pkg/controller/nodes/subworkflow/launchplan/admin_test.go index 89bb0e2477b..2a442e32627 100644 --- a/flytepropeller/pkg/controller/nodes/subworkflow/launchplan/admin_test.go +++ b/flytepropeller/pkg/controller/nodes/subworkflow/launchplan/admin_test.go @@ -2,6 +2,7 @@ package launchplan import ( "context" + "reflect" "testing" "time" @@ -162,10 +163,14 @@ func TestAdminLaunchPlanExecutor_Launch(t *testing.T) { ctx, mock.MatchedBy(func(o *admin.ExecutionCreateRequest) bool { return o.Project == "p" && o.Domain == "d" && o.Name == "n" && o.Spec.Inputs == nil && - o.Spec.Metadata.Mode == admin.ExecutionMetadata_CHILD_WORKFLOW + o.Spec.Metadata.Mode == admin.ExecutionMetadata_CHILD_WORKFLOW && + reflect.DeepEqual(o.Spec.Labels.Values, map[string]string{"foo": "bar"}) // Ensure shard-key was removed. }), ).Return(nil, nil) assert.NoError(t, err) + + var labels = map[string]string{"foo": "bar", "shard-key": "1"} + err = exec.Launch(ctx, LaunchContext{ ParentNodeExecution: &core.NodeExecutionIdentifier{ @@ -176,12 +181,15 @@ func TestAdminLaunchPlanExecutor_Launch(t *testing.T) { Name: "w", }, }, + Labels: labels, }, id, &core.Identifier{}, nil, ) assert.NoError(t, err) + // Ensure we haven't mutated the state of the parent workflow. + assert.True(t, reflect.DeepEqual(labels, map[string]string{"foo": "bar", "shard-key": "1"})) }) t.Run("happy recover", func(t *testing.T) {