forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster_workflow_template_test.go
60 lines (52 loc) · 1.66 KB
/
cluster_workflow_template_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// +build functional
package e2e
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/argoproj/argo-workflows/v3/test/e2e/fixtures"
)
type ClusterWorkflowTemplateSuite struct {
fixtures.E2ESuite
}
func (s *ClusterWorkflowTemplateSuite) TestSubmitClusterWorkflowTemplate() {
s.Given().
ClusterWorkflowTemplate("@smoke/cluster-workflow-template-whalesay-template.yaml").
When().
CreateClusterWorkflowTemplates().
RunCli([]string{"submit", "--from", "clusterworkflowtemplate/cluster-workflow-template-whalesay-template", "--name", "my-wf", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) {
assert.NoError(t, err)
}).
WaitForWorkflow(fixtures.ToBeSucceeded)
}
func (s *ClusterWorkflowTemplateSuite) TestNestedClusterWorkflowTemplate() {
s.Given().
ClusterWorkflowTemplate("@testdata/cluster-workflow-template-nested-template.yaml").
When().Given().
ClusterWorkflowTemplate("@smoke/cluster-workflow-template-whalesay-template.yaml").
When().CreateClusterWorkflowTemplates().
Given().
Workflow(`
metadata:
generateName: cwft-wf-
spec:
entrypoint: whalesay
templates:
- name: whalesay
steps:
- - name: call-whalesay-template
templateRef:
name: cluster-workflow-template-nested-template
template: whalesay-template
clusterScope: true
arguments:
parameters:
- name: message
value: hello from nested
`).When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeSucceeded)
}
func TestClusterWorkflowTemplateSuite(t *testing.T) {
suite.Run(t, new(ClusterWorkflowTemplateSuite))
}