From 4deb2ec97ee28b3851b582fd661b875059d2e557 Mon Sep 17 00:00:00 2001 From: Mason Malone <651224+MasonM@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:44:58 -0800 Subject: [PATCH] test: fix more tests using invalid images Signed-off-by: Mason Malone <651224+MasonM@users.noreply.github.com> --- test/e2e/cron/basic-update-template.yaml | 5 +- .../e2e/cron/cron-and-malformed-template.yaml | 5 +- test/e2e/cron/param.yaml | 5 +- .../exit-handler-fail-missing-output.yaml | 7 ++- .../parallelism-dag-fail-fast.yaml | 10 ++-- .../parallelism-step-fail-fast.yaml | 10 ++-- test/e2e/fixtures/given.go | 10 ---- test/e2e/functional/dag-empty-param.yaml | 8 +-- 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 | 11 ++-- test/e2e/hooks_test.go | 53 +++++++------------ .../testdata/artifact-passing-workflow.yaml | 4 +- ...g-wf-stopped-pod-gc-on-pod-completion.yaml | 6 +-- .../artifactgc/artgc-dag-wf-stopped.yaml | 6 +-- .../complex-global-artifact-passing.yaml | 14 ++--- .../testdata/cronworkflow-metrics-forbid.yaml | 4 +- .../cronworkflow-metrics-replace.yaml | 4 +- test/e2e/testdata/node-suspend.yaml | 7 ++- test/e2e/testdata/retry-on-stopped.yaml | 4 +- ...try-workflow-with-failed-exit-handler.yaml | 10 ++-- test/e2e/testdata/wf-default-ns.yaml | 5 +- .../workflow-template-with-containerset.yaml | 15 ++---- 24 files changed, 85 insertions(+), 153 deletions(-) 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/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 668e5865f703..adc6469e0638 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" @@ -120,16 +118,11 @@ func (g *Given) checkImages(wf interface{}, isExample bool) { g.t.Fatalf("Unsupported checkImage workflow type: %s", wf) } - // discouraged - discouraged := func(image string) bool { - return image == "python:alpine3.6" && !isExample - } allowed := func(image string) bool { return strings.Contains(image, "argoexec:") || image == "argoproj/argosay:v1" || image == "argoproj/argosay:v2" || image == "quay.io/argoproj/argocli:latest" || - discouraged(image) || (isExample && (image == "busybox" || image == "python:alpine3.6")) } for _, t := range templates { @@ -147,9 +140,6 @@ func (g *Given) checkImages(wf interface{}, isExample bool) { // (⎈ |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)) - } } } } 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/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..c92e25a36cf3 100644 --- a/test/e2e/functional/sidecar-volumes.yaml +++ b/test/e2e/functional/sidecar-volumes.yaml @@ -23,14 +23,11 @@ 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 + image: argoproj/argosay:v2 command: [sh, -c] args: ["echo 'it works' > /mnt/vol/test-art"] volumeMounts: @@ -39,7 +36,7 @@ spec: - 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..37097583a675 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/testdata/artifact-passing-workflow.yaml b/test/e2e/testdata/artifact-passing-workflow.yaml index b2c25881fb57..7d68ec74bb27 100644 --- a/test/e2e/testdata/artifact-passing-workflow.yaml +++ b/test/e2e/testdata/artifact-passing-workflow.yaml @@ -20,7 +20,7 @@ spec: - name: create-message container: - image: alpine:latest + image: argoproj/argosay:v2 command: [sh, -c] args: ["echo ':) Hello Argo!' | tee /tmp/hello_world.txt"] outputs: @@ -40,6 +40,6 @@ spec: - name: message path: /tmp/message container: - image: alpine:latest + image: argoproj/argosay:v2 command: [sh, -c] args: ["cat /tmp/message"] \ No newline at end of file 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..f6f4b02f0d10 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,9 +155,9 @@ 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 name: "" resources: {} inputs: @@ -173,9 +173,9 @@ spec: path: /upload/testUpload.txt - container: + image: alpine:3.18.4 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-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/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/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-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/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-template-with-containerset.yaml b/test/e2e/testdata/workflow-template-with-containerset.yaml index b2f4c32a880a..3af13beec57c 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 - command: + image: argoproj/argosay:v2 + args: - 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