Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Newton committed Apr 3, 2024
1 parent 604405e commit ebee557
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package launchplan

import (
"context"
"reflect"
"testing"
"time"

Expand Down Expand Up @@ -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{
Expand All @@ -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) {
Expand Down

0 comments on commit ebee557

Please sign in to comment.