Skip to content

Commit

Permalink
test: added test for default cm global param value
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohankmr414 committed Oct 10, 2022
1 parent 4202ba9 commit dc351a0
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/e2e/workflow_configmap_substitution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,47 @@ spec:
})
}

func (s *WorkflowConfigMapSelectorSubstitutionSuite) TestGlobalArgDefaultCMParamValueWhenNotFound() {
s.Given().
Workflow(`apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: workflow-template-cmkeyselector-wf-global-arg-default-param-
label:
workflows.argoproj.io/test: "true"
spec:
serviceAccountName: argo
entrypoint: whalesay
arguments:
parameters:
- name: simple-global-param
valueFrom:
default: "default value"
configMapKeyRef:
name: not-existing-cm
key: not-existing-key
templates:
- name: whalesay
container:
image: argoproj/argosay:v2
command: [sh, -c]
args: ["sleep 1; echo -n {{workflow.parameters.simple-global-param}} > /tmp/message.txt"]
outputs:
parameters:
- name: message
valueFrom:
path: /tmp/message.txt
`).
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeSucceeded).
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
assert.Equal(t, "default value", status.Nodes[metadata.Name].Outputs.Parameters[0].Value.String())
assert.Equal(t, wfv1.WorkflowSucceeded, status.Phase)
})
}

func TestConfigMapKeySelectorSubstitutionSuite(t *testing.T) {
suite.Run(t, new(WorkflowConfigMapSelectorSubstitutionSuite))
}

0 comments on commit dc351a0

Please sign in to comment.