From 7ad099fe973be874d3599b6af28d0aa686c080f7 Mon Sep 17 00:00:00 2001 From: Drew Wells Date: Thu, 21 Sep 2023 11:54:36 -0500 Subject: [PATCH] test parameterKey can update an array Signed-off-by: Drew Wells --- pkg/hooks/data_passing_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkg/hooks/data_passing_test.go b/pkg/hooks/data_passing_test.go index c16a7245..2d31953e 100644 --- a/pkg/hooks/data_passing_test.go +++ b/pkg/hooks/data_passing_test.go @@ -74,6 +74,27 @@ func TestInput(t *testing.T) { r.NoError(err) r.Equal(s, `99 `) + + // test array value + paramValue, err = wfCtx.MakeParameter(`parameter: {myscore: ["test"]}`) + r.NoError(err) + err = Input(wfCtx, paramValue, v1alpha1.WorkflowStep{ + WorkflowStepBase: v1alpha1.WorkflowStepBase{ + DependsOn: []string{"mystep"}, + Inputs: v1alpha1.StepInputs{{ + From: "foo.score", + ParameterKey: "myscore[0]", + }}, + }, + }) + r.NoError(err) + result, err = paramValue.LookupValue("parameter", "myscore") + r.NoError(err) + s, err = result.String() + r.NoError(err) + r.Equal(s, `[99] +`) + paramValue, err = wfCtx.MakeParameter(`context: {name: "test"}`) r.NoError(err) err = Input(wfCtx, paramValue, v1alpha1.WorkflowStep{