@@ -21,6 +21,7 @@ import (
2121
2222 wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
2323 "github.com/argoproj/argo-workflows/v3/test/e2e/fixtures"
24+ "github.com/argoproj/argo-workflows/v3/workflow/common"
2425)
2526
2627const (
@@ -224,6 +225,42 @@ func (s *CLISuite) TestSubmitServerDryRun() {
224225 })
225226}
226227
228+ func (s * CLISuite ) TestSubmitWorkflowTemplateDryRun () {
229+ s .Given ().
230+ WorkflowTemplate ("@smoke/workflow-template-whalesay-template.yaml" ).
231+ When ().
232+ CreateWorkflowTemplates ().
233+ RunCli ([]string {"submit" , "--dry-run" , "--from" , "workflowtemplate/workflow-template-whalesay-template" , "-o" , "yaml" , "-l" , "workflows.argoproj.io/test=true" }, func (t * testing.T , output string , err error ) {
234+ if assert .NoError (t , err ) {
235+ assert .Contains (t , output , "generateName: workflow-template-whalesay-template-" )
236+ // dry-run should never get a UID
237+ assert .NotContains (t , output , "uid:" )
238+ }
239+ }).
240+ Then ().
241+ ExpectWorkflowList (metav1.ListOptions {LabelSelector : common .LabelKeyWorkflowTemplate + "=workflow-template-whalesay-template" }, func (t * testing.T , wfList * wfv1.WorkflowList ) {
242+ assert .Equal (t , 0 , len (wfList .Items ))
243+ })
244+ }
245+
246+ func (s * CLISuite ) TestSubmitWorkflowTemplateServerDryRun () {
247+ s .Given ().
248+ WorkflowTemplate ("@smoke/workflow-template-whalesay-template.yaml" ).
249+ When ().
250+ CreateWorkflowTemplates ().
251+ RunCli ([]string {"submit" , "--server-dry-run" , "--from" , "workflowtemplate/workflow-template-whalesay-template" , "-o" , "yaml" , "-l" , "workflows.argoproj.io/test=true" }, func (t * testing.T , output string , err error ) {
252+ if assert .NoError (t , err ) {
253+ assert .Contains (t , output , "generateName: workflow-template-whalesay-template-" )
254+ // server-dry-run should get a UID
255+ assert .Contains (t , output , "uid:" )
256+ }
257+ }).
258+ Then ().
259+ ExpectWorkflowList (metav1.ListOptions {LabelSelector : common .LabelKeyWorkflowTemplate + "=workflow-template-whalesay-template" }, func (t * testing.T , wfList * wfv1.WorkflowList ) {
260+ assert .Equal (t , 0 , len (wfList .Items ))
261+ })
262+ }
263+
227264func (s * CLISuite ) TestTokenArg () {
228265 if os .Getenv ("CI" ) != "true" {
229266 s .T ().Skip ("we only set-up the KUBECONFIG on CI" )
0 commit comments