From 89d75a695df9f65890a6b492e4019ab75556be20 Mon Sep 17 00:00:00 2001 From: Mason Malone <651224+MasonM@users.noreply.github.com> Date: Sun, 19 Jan 2025 06:55:01 -0500 Subject: [PATCH] test: refactor E2E examples tests and fix `Makefile` (#14094) Signed-off-by: Mason Malone <651224+MasonM@users.noreply.github.com> --- .github/workflows/ci-build.yaml | 1 - Makefile | 6 +-- examples/webhdfs-input-output-artifacts.yaml | 1 - hack/test-examples.sh | 27 ---------- test/e2e/cli_test.go | 1 - test/e2e/cron/basic-update-template.yaml | 5 +- .../e2e/cron/cron-and-malformed-template.yaml | 5 +- test/e2e/cron/param.yaml | 5 +- test/e2e/cron_test.go | 3 +- test/e2e/examples_test.go | 47 ++++++++++++++++ .../exit-handler-fail-missing-output.yaml | 7 ++- .../parallelism-dag-fail-fast.yaml | 10 ++-- .../parallelism-step-fail-fast.yaml | 10 ++-- test/e2e/fixtures/given.go | 50 ++++++++++------- test/e2e/functional/dag-empty-param.yaml | 8 +-- .../functional/entrypointName-template.yaml | 5 +- test/e2e/functional/loops-empty-param.yaml | 8 +-- .../param-aggregation-fromoutputs.yaml | 18 ++----- test/e2e/functional/retry-script.yaml | 9 ++-- test/e2e/functional/sidecar-volumes.yaml | 14 ++--- test/e2e/hooks_test.go | 53 +++++++------------ test/e2e/malformed_resources_test.go | 22 ++++---- .../testdata/artifact-passing-workflow.yaml | 10 ++-- .../testdata/artifact-workflow-stopped.yaml | 4 +- .../artifactgc/artgc-dag-wf-self-delete.yaml | 4 +- ...g-wf-stopped-pod-gc-on-pod-completion.yaml | 6 +-- .../artifactgc/artgc-dag-wf-stopped.yaml | 6 +-- .../complex-global-artifact-passing.yaml | 18 +++---- .../cronworkflow-deprecated-schedule.yaml | 4 +- .../testdata/cronworkflow-metrics-forbid.yaml | 4 +- .../cronworkflow-metrics-replace.yaml | 4 +- .../loops-steps-limited-parallelism-pvc.yaml | 4 +- test/e2e/testdata/node-suspend.yaml | 7 ++- .../resubmit-dag-with-dependencies.yaml | 12 ++--- test/e2e/testdata/retry-on-stopped.yaml | 4 +- .../retry-workflow-with-continueon.yaml | 4 +- ...try-workflow-with-failed-exit-handler.yaml | 10 ++-- ...late-status-failed-conditional-metric.yaml | 2 +- test/e2e/testdata/wf-default-ns.yaml | 5 +- test/e2e/testdata/workflow-dag-metrics.yaml | 2 +- .../workflow-template-with-containerset.yaml | 13 ++--- test/e2e/workflow_test.go | 2 +- 42 files changed, 199 insertions(+), 241 deletions(-) delete mode 100755 hack/test-examples.sh create mode 100644 test/e2e/examples_test.go diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 69ecd44dcb55..6687a71bcd3e 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -61,7 +61,6 @@ jobs: - sdks/** # example test suite - examples/** - - hack/test-examples.sh codegen: - *common # generated files diff --git a/Makefile b/Makefile index 71c80000f0e3..e4d13a7c461c 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ endif # -- install & run options PROFILE ?= minimal KUBE_NAMESPACE ?= argo # namespace where Kubernetes resources/RBAC will be installed -PLUGINS ?= $(shell [ $PROFILE = plugins ] && echo false || echo true) +PLUGINS ?= $(shell [ $(PROFILE) = plugins ] && echo true || echo false) UI ?= false # start the UI with HTTP UI_SECURE ?= false # start the UI with HTTPS API ?= $(UI) # start the Argo Server @@ -608,10 +608,6 @@ test-cli: ./dist/argo test-%: E2E_WAIT_TIMEOUT=$(E2E_WAIT_TIMEOUT) go test -failfast -v -timeout $(E2E_SUITE_TIMEOUT) -count 1 --tags $* -parallel $(E2E_PARALLEL) ./test/e2e -.PHONY: test-examples -test-examples: - ./hack/test-examples.sh - .PHONY: test-%-sdk test-%-sdk: make --directory sdks/$* install test -B diff --git a/examples/webhdfs-input-output-artifacts.yaml b/examples/webhdfs-input-output-artifacts.yaml index 5ed04c3a0550..138073128898 100644 --- a/examples/webhdfs-input-output-artifacts.yaml +++ b/examples/webhdfs-input-output-artifacts.yaml @@ -49,7 +49,6 @@ spec: artifacts: - name: my-art2 path: /my-artifact - overwrite: true http: # below is an example on how to use authentication via certificates # clientCert.clientCertSecret: points to a kubernetes secret named cert-sec with a data entry of "certificate.pem" diff --git a/hack/test-examples.sh b/hack/test-examples.sh deleted file mode 100755 index 78ddec9135e0..000000000000 --- a/hack/test-examples.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -eu -o pipefail - -# Load the configmaps that contains the parameter values used for certain examples. -kubectl apply -f examples/configmaps/simple-parameters-configmap.yaml - -echo "Checking for banned images..." -grep -lR 'workflows.argoproj.io/test' examples/* | while read f ; do - echo " - $f" - test 0 == $(grep -o 'image: .*' $f | grep -cv 'argoproj/argosay:v2\|python:alpine3.6\|busybox') -done - -trap 'kubectl get wf' EXIT - -grep -lR 'workflows.argoproj.io/test' examples/* | while read f ; do - echo "Running $f..." - name=$(kubectl create -f $f -o name) - - echo "Waiting for completion of $f..." - kubectl wait --for=condition=Completed $name - phase="$(kubectl get $name -o 'jsonpath={.status.phase}')" - echo " -> $phase" - test Succeeded == $phase - - echo "Deleting $f..." - kubectl delete $name -done diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index 267ed98ad48e..912db6eac6eb 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -1392,7 +1392,6 @@ func (s *CLISuite) TestCronCommands() { assert.Contains(t, output, "5 5 5 * *") assert.Contains(t, output, "Replace") assert.Contains(t, output, "whalesay") - assert.NotContains(t, output, "argosay") }) }) s.Run("Create Parameter Override", func() { diff --git a/test/e2e/cron/basic-update-template.yaml b/test/e2e/cron/basic-update-template.yaml index 075d5f797325..e841ca8dd71e 100644 --- a/test/e2e/cron/basic-update-template.yaml +++ b/test/e2e/cron/basic-update-template.yaml @@ -26,6 +26,5 @@ spec: parameters: - name: message container: - image: python:alpine3.6 - command: [ "sh", -c ] - args: [ "echo {{inputs.parameters.message}}" ] \ No newline at end of file + image: argoproj/argosay:v2 + args: [ "echo", "{{inputs.parameters.message}}" ] \ No newline at end of file diff --git a/test/e2e/cron/cron-and-malformed-template.yaml b/test/e2e/cron/cron-and-malformed-template.yaml index 936a5a3b4c6d..a13295936ced 100644 --- a/test/e2e/cron/cron-and-malformed-template.yaml +++ b/test/e2e/cron/cron-and-malformed-template.yaml @@ -18,9 +18,8 @@ spec: templates: - name: whalesay container: - image: python:alpine3.6 - command: ["sh", -c] - args: ["echo hello"] + image: argoproj/argosay:v2 + args: ["echo", "hello"] --- diff --git a/test/e2e/cron/param.yaml b/test/e2e/cron/param.yaml index 16093c9ab11f..1de6991ba0da 100644 --- a/test/e2e/cron/param.yaml +++ b/test/e2e/cron/param.yaml @@ -25,6 +25,5 @@ spec: parameters: - name: message container: - image: python:alpine3.6 - command: ["sh", -c] - args: ["echo {{inputs.parameters.message}}"] + image: argoproj/argosay:v2 + args: ["echo", "{{inputs.parameters.message}}"] diff --git a/test/e2e/cron_test.go b/test/e2e/cron_test.go index 99ef4eefd894..010257375247 100644 --- a/test/e2e/cron_test.go +++ b/test/e2e/cron_test.go @@ -454,8 +454,7 @@ spec: } func (s *CronSuite) TestMalformedCronWorkflow() { - s.Given(). - Exec("kubectl", []string{"apply", "-f", "testdata/malformed/malformed-cronworkflow.yaml"}, fixtures.ErrorOutput("unknown field \"spec.workflowSpec.arguments.parameters.someParam\"")) + s.Given().KubectlApply("testdata/malformed/malformed-cronworkflow.yaml", fixtures.ErrorOutput(".spec.workflowSpec.arguments.parameters: expected list")) } func TestCronSuite(t *testing.T) { diff --git a/test/e2e/examples_test.go b/test/e2e/examples_test.go new file mode 100644 index 000000000000..ab9a626b9e3d --- /dev/null +++ b/test/e2e/examples_test.go @@ -0,0 +1,47 @@ +//go:build examples + +package e2e + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + "github.com/argoproj/argo-workflows/v3/test/e2e/fixtures" + fileutil "github.com/argoproj/argo-workflows/v3/util/file" + "github.com/argoproj/argo-workflows/v3/workflow/common" +) + +type ExamplesSuite struct { + fixtures.E2ESuite +} + +func (s *ExamplesSuite) BeforeTest(suiteName, testName string) { + s.E2ESuite.BeforeTest(suiteName, testName) + s.Given().KubectlApply("../../examples/configmaps/simple-parameters-configmap.yaml", fixtures.NoError) +} + +func (s *ExamplesSuite) TestExampleWorkflows() { + err := fileutil.WalkManifests("../../examples", func(path string, data []byte) error { + wfs, err := common.SplitWorkflowYAMLFile(data, true) + if err != nil { + s.T().Fatalf("Error parsing %s: %v", path, err) + } + for _, wf := range wfs { + if _, ok := wf.GetLabels()["workflows.argoproj.io/test"]; ok { + s.T().Logf("Found example workflow at %s with test label\n", path) + s.Given(). + ExampleWorkflow(&wf). + When(). + SubmitWorkflow(). + WaitForWorkflow(fixtures.ToBeSucceeded) + } + } + return nil + }) + s.CheckError(err) +} + +func TestExamplesSuite(t *testing.T) { + suite.Run(t, new(ExamplesSuite)) +} diff --git a/test/e2e/expectedfailures/exit-handler-fail-missing-output.yaml b/test/e2e/expectedfailures/exit-handler-fail-missing-output.yaml index c62fe4beb9b5..1493953c847f 100644 --- a/test/e2e/expectedfailures/exit-handler-fail-missing-output.yaml +++ b/test/e2e/expectedfailures/exit-handler-fail-missing-output.yaml @@ -26,7 +26,7 @@ spec: valueFrom: path: /tmp/hello_world.txt container: - image: alpine:latest + image: argoproj/argosay:v2 command: ["sh", "-c"] args: ["echo intentional failure; exit 1"] - name: lifecycle-hook @@ -34,6 +34,5 @@ spec: parameters: - name: hello-param container: - image: busybox - command: [echo] - args: ["Hello param: {{inputs.parameters.hello-param}}"] + image: argoproj/argosay:v2 + args: ["echo", "Hello param: {{inputs.parameters.hello-param}}"] diff --git a/test/e2e/expectedfailures/parallelism-dag-fail-fast.yaml b/test/e2e/expectedfailures/parallelism-dag-fail-fast.yaml index fa52fc621913..1c317bab5ee5 100644 --- a/test/e2e/expectedfailures/parallelism-dag-fail-fast.yaml +++ b/test/e2e/expectedfailures/parallelism-dag-fail-fast.yaml @@ -16,11 +16,9 @@ spec: template: sleep - name: fail container: - image: alpine:latest - command: [ sh, -c ] - args: ["exit 1"] + image: argoproj/argosay:v2 + args: ["exit", "1"] - name: sleep container: - image: alpine:latest - command: [sh, -c] - args: ["sleep 5"] \ No newline at end of file + image: argoproj/argosay:v2 + args: ["sleep", "5"] \ No newline at end of file diff --git a/test/e2e/expectedfailures/parallelism-step-fail-fast.yaml b/test/e2e/expectedfailures/parallelism-step-fail-fast.yaml index 04c7798eb20f..dd9e6fcc2fbf 100644 --- a/test/e2e/expectedfailures/parallelism-step-fail-fast.yaml +++ b/test/e2e/expectedfailures/parallelism-step-fail-fast.yaml @@ -15,11 +15,9 @@ spec: template: sleep - name: fail container: - image: alpine:latest - command: [sh, -c] - args: ["exit 1"] + image: argoproj/argosay:v2 + command: ["exit", "1"] - name: sleep container: - image: alpine:latest - command: [ sh, -c ] - args: [ "sleep 5" ] \ No newline at end of file + image: argoproj/argosay:v2 + command: ["sleep", "5"] \ No newline at end of file diff --git a/test/e2e/fixtures/given.go b/test/e2e/fixtures/given.go index 7898715542c7..d5fc4674ce57 100644 --- a/test/e2e/fixtures/given.go +++ b/test/e2e/fixtures/given.go @@ -1,13 +1,11 @@ package fixtures import ( - "fmt" "os" "path/filepath" "strings" "testing" - "github.com/TwiN/go-color" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -45,7 +43,16 @@ func (g *Given) Workflow(text string) *Given { g.t.Helper() g.wf = &wfv1.Workflow{} g.readResource(text, g.wf) - g.checkImages(g.wf) + g.checkImages(g.wf, false) + return g +} + +// Load parsed Workflow that's assumed to be from the "examples/" directory +func (g *Given) ExampleWorkflow(wf *wfv1.Workflow) *Given { + g.t.Helper() + g.wf = wf + g.checkLabels(wf) + g.checkImages(g.wf, true) return g } @@ -83,38 +90,40 @@ func (g *Given) readResource(text string, v metav1.Object) { } } -func (g *Given) checkImages(wf interface{}) { +// Check if given Workflow, WorkflowTemplate, or CronWorkflow uses forbidden images. +// Using an arbitrary image will result in slow and flakey tests as we can't really predict when they'll be +// downloaded or evicted. To keep tests fast and reliable you must use allowed images. +// Workflows from the examples/ folder are given special treatment and allowed to use a wider range of images. +func (g *Given) checkImages(wf interface{}, isExample bool) { g.t.Helper() var defaultImage string var templates []wfv1.Template switch baseTemplate := wf.(type) { case *wfv1.Workflow: + templates = baseTemplate.Spec.Templates if baseTemplate.Spec.TemplateDefaults != nil && baseTemplate.Spec.TemplateDefaults.Container != nil && baseTemplate.Spec.TemplateDefaults.Container.Image != "" { defaultImage = baseTemplate.Spec.TemplateDefaults.Container.Image - templates = baseTemplate.Spec.Templates } case *wfv1.WorkflowTemplate: + templates = baseTemplate.Spec.Templates if baseTemplate.Spec.TemplateDefaults != nil && baseTemplate.Spec.TemplateDefaults.Container != nil && baseTemplate.Spec.TemplateDefaults.Container.Image != "" { defaultImage = baseTemplate.Spec.TemplateDefaults.Container.Image - templates = baseTemplate.Spec.Templates } case *wfv1.CronWorkflow: + templates = baseTemplate.Spec.WorkflowSpec.Templates if baseTemplate.Spec.WorkflowSpec.TemplateDefaults != nil && baseTemplate.Spec.WorkflowSpec.TemplateDefaults.Container != nil && baseTemplate.Spec.WorkflowSpec.TemplateDefaults.Container.Image != "" { defaultImage = baseTemplate.Spec.WorkflowSpec.TemplateDefaults.Container.Image - templates = baseTemplate.Spec.WorkflowSpec.Templates } default: g.t.Fatalf("Unsupported checkImage workflow type: %s", wf) } - // discouraged - discouraged := func(image string) bool { - return image == "python:alpine3.6" - } - // Using an arbitrary image will result in slow and flakey tests as we can't really predict when they'll be - // downloaded or evicted. To keep tests fast and reliable you must use allowed images. allowed := func(image string) bool { - return strings.Contains(image, "argoexec:") || image == "argoproj/argosay:v1" || image == "argoproj/argosay:v2" || discouraged(image) + return strings.Contains(image, "argoexec:") || + image == "argoproj/argosay:v1" || + image == "argoproj/argosay:v2" || + image == "quay.io/argoproj/argocli:latest" || + (isExample && (image == "busybox" || image == "python:alpine3.6")) } for _, t := range templates { container := t.Container @@ -131,9 +140,6 @@ func (g *Given) checkImages(wf interface{}) { // (⎈ |docker-desktop:argo)➜ ~ time docker run --rm argoproj/argosay:v2 // docker run --rm argoproj/argosay˜:v2 0.21s user 0.10s system 16% cpu 1.912 total // docker run --rm argoproj/argosay:v1 0.17s user 0.08s system 31% cpu 0.784 total - if discouraged(image) { - _, _ = fmt.Println(color.Ize(color.Yellow, "DISCOURAGED IMAGE: "+g.t.Name()+" is using "+image)) - } } } } @@ -168,7 +174,7 @@ func (g *Given) WorkflowTemplate(text string) *Given { g.t.Helper() wfTemplate := &wfv1.WorkflowTemplate{} g.readResource(text, wfTemplate) - g.checkImages(wfTemplate) + g.checkImages(wfTemplate, false) g.wfTemplates = append(g.wfTemplates, wfTemplate) return g } @@ -177,7 +183,7 @@ func (g *Given) CronWorkflow(text string) *Given { g.t.Helper() g.cronWf = &wfv1.CronWorkflow{} g.readResource(text, g.cronWf) - g.checkImages(g.cronWf) + g.checkImages(g.cronWf, false) return g } @@ -209,6 +215,12 @@ func (g *Given) Exec(name string, args []string, block func(t *testing.T, output return g } +// Use Kubectl to server-side apply the given file +func (g *Given) KubectlApply(file string, block func(t *testing.T, output string, err error)) *Given { + g.t.Helper() + return g.Exec("kubectl", append([]string{"-n", Namespace, "apply", "--server-side", "-f"}, file), block) +} + func (g *Given) RunCli(args []string, block func(t *testing.T, output string, err error)) *Given { return g.Exec("../../dist/argo", append([]string{"-n", Namespace}, args...), block) } diff --git a/test/e2e/functional/dag-empty-param.yaml b/test/e2e/functional/dag-empty-param.yaml index 6593c4af9ff4..35a655493b47 100644 --- a/test/e2e/functional/dag-empty-param.yaml +++ b/test/e2e/functional/dag-empty-param.yaml @@ -22,12 +22,8 @@ spec: - name: gen-number-list script: - image: python:alpine3.6 - command: [python] - source: | - import json - import sys - json.dump([i for i in range(0, -1)], sys.stdout) + image: argoproj/argosay:v2 + args: ["echo", "[]"] - name: sleep-n-sec inputs: diff --git a/test/e2e/functional/entrypointName-template.yaml b/test/e2e/functional/entrypointName-template.yaml index eec2e0156efa..73f00606049a 100644 --- a/test/e2e/functional/entrypointName-template.yaml +++ b/test/e2e/functional/entrypointName-template.yaml @@ -11,6 +11,5 @@ spec: - name: test value: "{{ workflow.mainEntrypoint }}" container: - image: alpine - command: [echo] - args: ["We got here!"] + image: argoproj/argosay:v2 + args: [echo, "We got here!"] diff --git a/test/e2e/functional/loops-empty-param.yaml b/test/e2e/functional/loops-empty-param.yaml index c72ab76a7d00..8734f55df8d7 100644 --- a/test/e2e/functional/loops-empty-param.yaml +++ b/test/e2e/functional/loops-empty-param.yaml @@ -19,12 +19,8 @@ spec: - name: gen-number-list script: - image: python:alpine3.6 - command: [python] - source: | - import json - import sys - json.dump([i for i in range(0, -1)], sys.stdout) + image: argoproj/argosay:v2 + args: ["echo", "[]"] - name: sleep-n-sec inputs: diff --git a/test/e2e/functional/param-aggregation-fromoutputs.yaml b/test/e2e/functional/param-aggregation-fromoutputs.yaml index 74ac9e432dff..bb70568e45b0 100644 --- a/test/e2e/functional/param-aggregation-fromoutputs.yaml +++ b/test/e2e/functional/param-aggregation-fromoutputs.yaml @@ -14,21 +14,9 @@ spec: - name: output1 valueFrom: path: /tmp/fan_out.json - script: - command: - - python3 - image: python:3.11 - source: |- - import os - import sys - sys.path.append(os.getcwd()) - import json - try: param1 = json.loads(r'''{{inputs.parameters.param1}}''') - except: param1 = r'''{{inputs.parameters.param1}}''' - - with open('/tmp/fan_out.json', 'w') as f: - json.dump(param1, f) - print(json.dumps(param1)) + container: + image: argoproj/argosay:v2 + args: ["echo", "{{inputs.parameters.param1}}", "/tmp/fan_out.json"] - dag: tasks: - arguments: diff --git a/test/e2e/functional/retry-script.yaml b/test/e2e/functional/retry-script.yaml index 616f7939283e..34b6fd9e1f88 100644 --- a/test/e2e/functional/retry-script.yaml +++ b/test/e2e/functional/retry-script.yaml @@ -10,11 +10,8 @@ spec: retryStrategy: limit: 10 script: - image: python:alpine3.6 - command: ["python"] + image: argoproj/argosay:v2 + command: ["bash", "-c"] # fail with a 66% probability source: | - import random; - import sys; - exit_code = random.choice([0, 1, 1]); - sys.exit(exit_code) + (( $RANDOM % 3 > 0 )) diff --git a/test/e2e/functional/sidecar-volumes.yaml b/test/e2e/functional/sidecar-volumes.yaml index bc6436262655..2752ec6d4aa6 100644 --- a/test/e2e/functional/sidecar-volumes.yaml +++ b/test/e2e/functional/sidecar-volumes.yaml @@ -23,23 +23,19 @@ spec: - name: generate script: - image: python:alpine3.6 - command: [python] - source: | - import time - time.sleep(5) + image: argoproj/argosay:v2 + args: ["sleep", "5"] sidecars: - name: sidevol - image: alpine:latest - command: [sh, -c] - args: ["echo 'it works' > /mnt/vol/test-art"] + image: argoproj/argosay:v2 + args: ["echo", "it works", "/mnt/vol/test-art"] volumeMounts: - name: workdir mountPath: /mnt/vol - name: verify container: - image: alpine:latest + image: argoproj/argosay:v2 command: [sh, -c] args: ['[[ "$(cat /mnt/vol/test-art)" == "it works" ]]'] volumeMounts: diff --git a/test/e2e/hooks_test.go b/test/e2e/hooks_test.go index 23cb235ce161..dfc46859c29a 100644 --- a/test/e2e/hooks_test.go +++ b/test/e2e/hooks_test.go @@ -539,18 +539,13 @@ spec: synchronization: mutexes: - name: job - script: - image: alpine:latest - command: [/bin/sh] - source: | - sleep 4 + container: + image: argoproj/argosay:v2 + args: ["sleep", "4"] - name: exit0 - script: - image: alpine:latest - command: [/bin/sh] - source: | - sleep 2 - exit 0 + container: + image: argoproj/argosay:v2 + args: ["sleep", "2"] `).When(). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeSucceeded). @@ -691,18 +686,12 @@ spec: - name: output-artifact script: - image: python:alpine3.6 - command: [ python ] + image: argoproj/argosay:v2 + command: [/bin/sh] source: | - import time - import random - import sys - time.sleep(1) # lifecycle hook for running won't trigger unless it runs for more than "a few seconds" - with open("result.txt", "w") as f: - f.write("Welcome") - if {{retries}} == 2: - sys.exit(0) - sys.exit(1) + sleep 1 + echo 'Welcome' > result.txt + [ "{{retries}}" = "2" ] retryStrategy: limit: 2 outputs: @@ -712,21 +701,18 @@ spec: - name: started container: - image: python:alpine3.6 - command: [sh, -c] - args: ["echo STARTED!"] + image: argoproj/argosay:v2 + args: ["echo", "STARTED!"] - name: success container: - image: python:alpine3.6 - command: [sh, -c] - args: ["echo SUCCEEDED!"] + image: argoproj/argosay:v2 + args: ["echo", "SUCCEEDED!"] - name: failed container: - image: python:alpine3.6 - command: [sh, -c] - args: ["echo FAILED or ERROR!"] + image: argoproj/argosay:v2 + args: ["echo", "FAILED or ERROR!"] - name: print-artifact inputs: @@ -734,9 +720,8 @@ spec: - name: message path: /tmp/message container: - image: python:alpine3.6 - command: [sh, -c] - args: ["cat /tmp/message"] + image: argoproj/argosay:v2 + args: ["cat", "/tmp/message"] `).When(). SubmitWorkflow(). WaitForWorkflow(fixtures.ToBeCompleted). diff --git a/test/e2e/malformed_resources_test.go b/test/e2e/malformed_resources_test.go index e16ed970ee91..0fb7d2505cf4 100644 --- a/test/e2e/malformed_resources_test.go +++ b/test/e2e/malformed_resources_test.go @@ -18,14 +18,14 @@ type MalformedResourcesSuite struct { } func (s *MalformedResourcesSuite) TestMalformedWorkflow() { - s.Given().Exec("kubectl", []string{"apply", "-f", "testdata/malformed/malformed-workflow.yaml"}, fixtures.ErrorOutput("unknown field \"spec.arguments.parameters.someParam\"")) + s.Given().KubectlApply("testdata/malformed/malformed-workflow.yaml", fixtures.ErrorOutput(".spec.arguments.parameters: expected list")) } func (s *MalformedResourcesSuite) TestMalformedWorkflowTemplate() { s.Given(). - Exec("kubectl", []string{"apply", "-f", "testdata/malformed/malformed-workflowtemplate.yaml"}, fixtures.ErrorOutput("unknown field \"spec.arguments.parameters.someParam\"")). - Exec("kubectl", []string{"apply", "-f", "testdata/wellformed/wellformed-workflowtemplate.yaml"}, fixtures.NoError). - Exec("kubectl", []string{"apply", "-f", "testdata/wellformed/wellformed-workflow-with-workflow-template-ref.yaml"}, fixtures.NoError). + KubectlApply("testdata/malformed/malformed-workflowtemplate.yaml", fixtures.ErrorOutput(".spec.arguments.parameters: expected list")). + KubectlApply("testdata/wellformed/wellformed-workflowtemplate.yaml", fixtures.NoError). + KubectlApply("testdata/wellformed/wellformed-workflow-with-workflow-template-ref.yaml", fixtures.NoError). When(). WaitForWorkflow(). Then(). @@ -37,8 +37,8 @@ func (s *MalformedResourcesSuite) TestMalformedWorkflowTemplate() { func (s *MalformedResourcesSuite) TestMalformedWorkflowTemplateRef() { s.Given(). - Exec("kubectl", []string{"apply", "-f", "testdata/malformed/malformed-workflowtemplate.yaml"}, fixtures.ErrorOutput("unknown field \"spec.arguments.parameters.someParam\"")). - Exec("kubectl", []string{"apply", "-f", "testdata/wellformed/wellformed-workflow-with-malformed-workflow-template-ref.yaml"}, fixtures.NoError). + KubectlApply("testdata/malformed/malformed-workflowtemplate.yaml", fixtures.ErrorOutput(".spec.arguments.parameters: expected list")). + KubectlApply("testdata/wellformed/wellformed-workflow-with-malformed-workflow-template-ref.yaml", fixtures.NoError). When(). WaitForWorkflow(). Then(). @@ -51,9 +51,9 @@ func (s *MalformedResourcesSuite) TestMalformedWorkflowTemplateRef() { func (s *MalformedResourcesSuite) TestMalformedClusterWorkflowTemplate() { s.Given(). - Exec("kubectl", []string{"apply", "-f", "testdata/malformed/malformed-clusterworkflowtemplate.yaml"}, fixtures.ErrorOutput("unknown field \"spec.arguments.parameters.someParam\"")). - Exec("kubectl", []string{"apply", "-f", "testdata/wellformed/wellformed-clusterworkflowtemplate.yaml"}, fixtures.NoError). - Exec("kubectl", []string{"apply", "-f", "testdata/wellformed/wellformed-workflow-with-cluster-workflow-template-ref.yaml"}, fixtures.NoError). + KubectlApply("testdata/malformed/malformed-clusterworkflowtemplate.yaml", fixtures.ErrorOutput(".spec.arguments.parameters: expected list")). + KubectlApply("testdata/wellformed/wellformed-clusterworkflowtemplate.yaml", fixtures.NoError). + KubectlApply("testdata/wellformed/wellformed-workflow-with-cluster-workflow-template-ref.yaml", fixtures.NoError). When(). WaitForWorkflow(). Then(). @@ -65,8 +65,8 @@ func (s *MalformedResourcesSuite) TestMalformedClusterWorkflowTemplate() { func (s *MalformedResourcesSuite) TestMalformedClusterWorkflowTemplateRef() { s.Given(). - Exec("kubectl", []string{"apply", "-f", "testdata/malformed/malformed-clusterworkflowtemplate.yaml"}, fixtures.ErrorOutput("unknown field \"spec.arguments.parameters.someParam\"")). - Exec("kubectl", []string{"apply", "-f", "testdata/wellformed/wellformed-workflow-with-malformed-cluster-workflow-template-ref.yaml"}, fixtures.NoError). + KubectlApply("testdata/malformed/malformed-clusterworkflowtemplate.yaml", fixtures.ErrorOutput(".spec.arguments.parameters: expected list")). + KubectlApply("testdata/wellformed/wellformed-workflow-with-malformed-cluster-workflow-template-ref.yaml", fixtures.NoError). When(). WaitForWorkflow(). Then(). diff --git a/test/e2e/testdata/artifact-passing-workflow.yaml b/test/e2e/testdata/artifact-passing-workflow.yaml index b2c25881fb57..6553ae732b91 100644 --- a/test/e2e/testdata/artifact-passing-workflow.yaml +++ b/test/e2e/testdata/artifact-passing-workflow.yaml @@ -20,9 +20,8 @@ spec: - name: create-message container: - image: alpine:latest - command: [sh, -c] - args: ["echo ':) Hello Argo!' | tee /tmp/hello_world.txt"] + image: argoproj/argosay:v2 + args: ["echo", ":) Hello Argo!", "/tmp/hello_world.txt"] outputs: artifacts: # generate hello artifact from /tmp/hello_world.txt @@ -40,6 +39,5 @@ spec: - name: message path: /tmp/message container: - image: alpine:latest - command: [sh, -c] - args: ["cat /tmp/message"] \ No newline at end of file + image: argoproj/argosay:v2 + args: ["cat", "/tmp/message"] \ No newline at end of file diff --git a/test/e2e/testdata/artifact-workflow-stopped.yaml b/test/e2e/testdata/artifact-workflow-stopped.yaml index ae85aa207a3f..be510e42909e 100644 --- a/test/e2e/testdata/artifact-workflow-stopped.yaml +++ b/test/e2e/testdata/artifact-workflow-stopped.yaml @@ -32,7 +32,7 @@ spec: dependencies: [delay-stop-workflow] - name: delay-stop container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol @@ -66,7 +66,7 @@ spec: labels: template: "artifact-creator" container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol diff --git a/test/e2e/testdata/artifactgc/artgc-dag-wf-self-delete.yaml b/test/e2e/testdata/artifactgc/artgc-dag-wf-self-delete.yaml index ddce1199d629..0980a8cfc3ae 100644 --- a/test/e2e/testdata/artifactgc/artgc-dag-wf-self-delete.yaml +++ b/test/e2e/testdata/artifactgc/artgc-dag-wf-self-delete.yaml @@ -38,7 +38,7 @@ spec: dependencies: [delay-delete-workflow] - name: artgc-dag-delay-delete container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol @@ -72,7 +72,7 @@ spec: labels: template: "artgc-dag-artifact-creator" container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol diff --git a/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped-pod-gc-on-pod-completion.yaml b/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped-pod-gc-on-pod-completion.yaml index a1cf99967bb1..07c0115532ae 100644 --- a/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped-pod-gc-on-pod-completion.yaml +++ b/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped-pod-gc-on-pod-completion.yaml @@ -39,7 +39,7 @@ spec: dependencies: [delay-stop-workflow] - name: artgc-dag-delay-stop container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol @@ -73,7 +73,7 @@ spec: labels: template: "artgc-dag-artifact-creator-1" container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol @@ -104,7 +104,7 @@ spec: labels: template: "artgc-dag-artifact-creator-2" container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol diff --git a/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped.yaml b/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped.yaml index 12251ae51238..c6611aef21be 100644 --- a/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped.yaml +++ b/test/e2e/testdata/artifactgc/artgc-dag-wf-stopped.yaml @@ -41,7 +41,7 @@ spec: dependencies: [delay-stop-workflow] - name: artgc-dag-delay-stop container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol @@ -75,7 +75,7 @@ spec: labels: template: "artgc-dag-artifact-creator-1" container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol @@ -106,7 +106,7 @@ spec: labels: template: "artgc-dag-artifact-creator-2" container: - image: alpine:latest + image: argoproj/argosay:v2 volumeMounts: - name: artifacts mountPath: /mnt/vol diff --git a/test/e2e/testdata/complex-global-artifact-passing.yaml b/test/e2e/testdata/complex-global-artifact-passing.yaml index effca2dcb8b5..c210c41333c0 100644 --- a/test/e2e/testdata/complex-global-artifact-passing.yaml +++ b/test/e2e/testdata/complex-global-artifact-passing.yaml @@ -67,7 +67,7 @@ spec: - container: - image: alpine:3.7 + image: argoproj/argosay:v2 command: [sh, -c] args: ["sleep 1; echo -n 'test input' > /testInput.txt; echo -n 'test update' > /testUpdate.txt"] name: create-global-artifacts @@ -87,9 +87,9 @@ spec: - container: + image: argoproj/argosay:v2 command: [sh, -c] args: ["sleep 1; cp /input.txt /upload.txt"] - image: alpine:3.7 name: "" resources: {} inputs: @@ -104,9 +104,9 @@ spec: path: /upload.txt - container: + image: argoproj/argosay:v2 command: [sh, -c] args: ["sleep 1; echo -n 'Updated testUpdate' > /updated-testUpdate.txt"] - image: alpine:3.18.4 metadata: {} name: generate-testupdate-update outputs: @@ -117,9 +117,9 @@ spec: none: {} - container: + image: argoproj/argosay:v2 command: [sh, -c] args: ["sleep 1"] - image: alpine:3.18.4 name: "" resources: {} inputs: @@ -135,7 +135,7 @@ spec: path: /testUpload.txt - container: - image: alpine:3.18.4 + image: argoproj/argosay:v2 command: [sh, -c] args: ["sleep 1"] name: "" @@ -155,15 +155,15 @@ spec: - container: + image: argoproj/argosay:v2 command: [sh, -c] - args: ["sleep 1; cat /upload/testUpload; cat /upload/testUpload.txt > /upload/testUpload.txt"] - image: alpine:3.18.4 + args: ["sleep 1; cat /upload/testInput.txt > /upload/testUpload.txt"] name: "" resources: {} inputs: artifacts: - name: testUpload - path: /upload/testUpload.txt + path: /upload/testInput.txt metadata: {} name: upload-testupload outputs: @@ -173,9 +173,9 @@ spec: path: /upload/testUpload.txt - container: + image: argoproj/argosay:v2 command: [sh, -c] args: ["sleep 1; cat /upload/testUpdate.txt"] - image: alpine:3.18.4 name: "" resources: {} inputs: diff --git a/test/e2e/testdata/cronworkflow-deprecated-schedule.yaml b/test/e2e/testdata/cronworkflow-deprecated-schedule.yaml index b4717f809cbd..32951f84afb5 100644 --- a/test/e2e/testdata/cronworkflow-deprecated-schedule.yaml +++ b/test/e2e/testdata/cronworkflow-deprecated-schedule.yaml @@ -17,5 +17,5 @@ spec: templates: - name: sleep container: - image: alpine:latest - command: [sh, -c, "sleep 120"] + image: argoproj/argosay:v2 + args: ["sleep", "120"] diff --git a/test/e2e/testdata/cronworkflow-metrics-forbid.yaml b/test/e2e/testdata/cronworkflow-metrics-forbid.yaml index 7cac24d4fa01..1388c88b7ddb 100644 --- a/test/e2e/testdata/cronworkflow-metrics-forbid.yaml +++ b/test/e2e/testdata/cronworkflow-metrics-forbid.yaml @@ -17,5 +17,5 @@ spec: templates: - name: sleep container: - image: alpine:latest - command: [sh, -c, "sleep 120"] + image: argoproj/argosay:v2 + args: ["sleep", "120"] diff --git a/test/e2e/testdata/cronworkflow-metrics-replace.yaml b/test/e2e/testdata/cronworkflow-metrics-replace.yaml index b43521dbf033..ad6acc686b55 100644 --- a/test/e2e/testdata/cronworkflow-metrics-replace.yaml +++ b/test/e2e/testdata/cronworkflow-metrics-replace.yaml @@ -17,5 +17,5 @@ spec: templates: - name: sleep container: - image: alpine:latest - command: [sh, -c, "sleep 120"] + image: argoproj/argosay:v2 + args: ["sleep", "120"] diff --git a/test/e2e/testdata/loops-steps-limited-parallelism-pvc.yaml b/test/e2e/testdata/loops-steps-limited-parallelism-pvc.yaml index d63b0b4658df..6a367bb3688e 100644 --- a/test/e2e/testdata/loops-steps-limited-parallelism-pvc.yaml +++ b/test/e2e/testdata/loops-steps-limited-parallelism-pvc.yaml @@ -56,7 +56,7 @@ spec: parameters: - name: pvc script: - image: busybox:stable + image: argoproj/argosay:v2 command: ["sh"] source: | echo "Hello! i'm writing to pvc; '{{inputs.parameters.pvc}}'" >> /pvc/msg @@ -68,7 +68,7 @@ spec: parameters: - name: pvc script: - image: busybox:stable + image: argoproj/argosay:v2 command: ["sh"] source: | echo "Found the following message;" diff --git a/test/e2e/testdata/node-suspend.yaml b/test/e2e/testdata/node-suspend.yaml index a9a3923eb150..d0d092f38174 100644 --- a/test/e2e/testdata/node-suspend.yaml +++ b/test/e2e/testdata/node-suspend.yaml @@ -23,10 +23,9 @@ spec: value: "suspend2-{{steps.step1.outputs.result}}" - name: whalesay - script: - image: python:alpine3.6 - command: [sh] - source: echo tag1 + container: + image: argoproj/argosay:v2 + args: ["echo", "tag1"] - name: suspend inputs: diff --git a/test/e2e/testdata/resubmit-dag-with-dependencies.yaml b/test/e2e/testdata/resubmit-dag-with-dependencies.yaml index 18d5afa79266..8c5e68b1f6f5 100644 --- a/test/e2e/testdata/resubmit-dag-with-dependencies.yaml +++ b/test/e2e/testdata/resubmit-dag-with-dependencies.yaml @@ -23,13 +23,9 @@ spec: template: success - name: fail container: - image: busybox - command: ["sh", -c] - args: - - exit 1 + image: argoproj/argosay:v2 + args: ["exit", "1"] - name: success container: - image: busybox - command: ["sh", -c] - args: - - exit 0 \ No newline at end of file + image: argoproj/argosay:v2 + args: ["exit", "0"] \ No newline at end of file diff --git a/test/e2e/testdata/retry-on-stopped.yaml b/test/e2e/testdata/retry-on-stopped.yaml index 6b7276f570cb..a6a19296b66b 100644 --- a/test/e2e/testdata/retry-on-stopped.yaml +++ b/test/e2e/testdata/retry-on-stopped.yaml @@ -23,8 +23,8 @@ spec: - name: sleep container: - image: alpine:latest - command: [ sleep, "10" ] + image: argoproj/argosay:v2 + args: [ sleep, "10" ] - name: stop container: diff --git a/test/e2e/testdata/retry-workflow-with-continueon.yaml b/test/e2e/testdata/retry-workflow-with-continueon.yaml index 43a3b5670078..ca8c5dde2c7c 100644 --- a/test/e2e/testdata/retry-workflow-with-continueon.yaml +++ b/test/e2e/testdata/retry-workflow-with-continueon.yaml @@ -54,5 +54,5 @@ spec: parameters: - name: exitCode container: - image: alpine:3.7 - command: [ sh, "-c", "exit {{inputs.parameters.exitCode}}" ] \ No newline at end of file + image: argoproj/argosay:v2 + args: [ "exit", "{{inputs.parameters.exitCode}}" ] \ No newline at end of file diff --git a/test/e2e/testdata/retry-workflow-with-failed-exit-handler.yaml b/test/e2e/testdata/retry-workflow-with-failed-exit-handler.yaml index 565485c2b7f8..43413e7f213b 100644 --- a/test/e2e/testdata/retry-workflow-with-failed-exit-handler.yaml +++ b/test/e2e/testdata/retry-workflow-with-failed-exit-handler.yaml @@ -8,11 +8,9 @@ spec: templates: - name: hello container: - image: alpine:3.18 - command: [sh, -c] - args: ["echo hello"] + image: argoproj/argosay:v2 + args: ["echo", "hello"] - name: exit-handler container: - image: alpine:3.18 - command: [sh, -c] - args: ["exit 1"] \ No newline at end of file + image: argoproj/argosay:v2 + args: ["exit", "1"] \ No newline at end of file diff --git a/test/e2e/testdata/template-status-failed-conditional-metric.yaml b/test/e2e/testdata/template-status-failed-conditional-metric.yaml index 7fd9a166b1e6..8323a34ca377 100644 --- a/test/e2e/testdata/template-status-failed-conditional-metric.yaml +++ b/test/e2e/testdata/template-status-failed-conditional-metric.yaml @@ -27,5 +27,5 @@ spec: parameters: - name: message container: - image: alpine:3.7 + image: argoproj/argosay:v2 command: ["{{inputs.parameters.message}}"] \ No newline at end of file diff --git a/test/e2e/testdata/wf-default-ns.yaml b/test/e2e/testdata/wf-default-ns.yaml index 613336779cc6..c15908bf402b 100644 --- a/test/e2e/testdata/wf-default-ns.yaml +++ b/test/e2e/testdata/wf-default-ns.yaml @@ -19,6 +19,5 @@ spec: templates: - name: whalesay container: - image: python:alpine3.6 - command: [ "sh", -c ] - args: [ "echo hello" ] \ No newline at end of file + image: argoproj/argosay:v2 + args: [ "echo", "hello" ] \ No newline at end of file diff --git a/test/e2e/testdata/workflow-dag-metrics.yaml b/test/e2e/testdata/workflow-dag-metrics.yaml index a7573bf41a4b..184b2a72e7be 100644 --- a/test/e2e/testdata/workflow-dag-metrics.yaml +++ b/test/e2e/testdata/workflow-dag-metrics.yaml @@ -43,5 +43,5 @@ spec: parameters: - name: message container: - image: alpine:3.7 + image: argoproj/argosay:v2 command: [echo, "{{inputs.parameters.message}}"] diff --git a/test/e2e/testdata/workflow-template-with-containerset.yaml b/test/e2e/testdata/workflow-template-with-containerset.yaml index b2f4c32a880a..204224061a0f 100644 --- a/test/e2e/testdata/workflow-template-with-containerset.yaml +++ b/test/e2e/testdata/workflow-template-with-containerset.yaml @@ -14,19 +14,14 @@ spec: retries: "2" containers: - name: c1 - image: python:alpine3.6 - command: - - python - - -c - args: - - | - print("hi") + image: argoproj/argosay:v2 + args: ["echo", "hi"] - name: c2 - image: python:alpine3.6 + image: argoproj/argosay:v2 command: - invalid - command - name: c3 - image: alpine:latest + image: argoproj/argosay:v2 command: [ sh, -c ] args: [ "echo intentional failure; exit 1" ] \ No newline at end of file diff --git a/test/e2e/workflow_test.go b/test/e2e/workflow_test.go index 51c194614d5b..6af913f799d4 100644 --- a/test/e2e/workflow_test.go +++ b/test/e2e/workflow_test.go @@ -50,7 +50,7 @@ spec: parameters: - name: item container: - image: centos:latest + image: argoproj/argosay:v2 imagePullPolicy: Always command: - sh