From ccf4c612fd9abfdfc133aa3efc96dbf38a7ea11a Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 18 Feb 2021 07:37:53 -0800 Subject: [PATCH] test: Enhanced e2e tests (#5128) Signed-off-by: Alex Collins --- .github/workflows/ci-build.yaml | 2 + .golangci.yml | 1 + Makefile | 4 + docs/fields.md | 28 +++++ examples/output-result-workflow.yaml | 43 +++++++ go.mod | 2 + go.sum | 9 ++ test/e2e/argo_server_test.go | 103 +++++++--------- test/e2e/artifacts_test.go | 2 - test/e2e/cli_test.go | 116 +++++++++--------- test/e2e/cluster_workflow_template_test.go | 4 +- test/e2e/cron/basic.yaml | 4 +- test/e2e/cron/param.yaml | 4 +- test/e2e/cron_test.go | 18 +-- test/e2e/daemon_pod_test.go | 4 +- test/e2e/examples_test.go | 89 ++++++++++++++ .../expectedfailures/failed-step-event.yaml | 2 - test/e2e/expectedfailures/failed-step.yaml | 2 - .../pod-termination-failure.yaml | 2 - .../volumes-pvc-fail-event.yaml | 2 - test/e2e/fixtures/e2e_suite.go | 3 +- test/e2e/fixtures/given.go | 6 + test/e2e/fixtures/print.go | 44 +++++++ test/e2e/fixtures/when.go | 52 ++++---- test/e2e/functional/continue-on-failed.yaml | 2 - test/e2e/functional/dag-depends.yaml | 2 - test/e2e/functional/k8s-patch.yaml | 2 - test/e2e/functional/loops-empty-param.yaml | 2 - test/e2e/functional/param-aggregation.yaml | 2 - test/e2e/functional/resource-template.yaml | 53 ++++---- test/e2e/functional/stop-terminate-2.yaml | 2 - test/e2e/functional/stop-terminate.yaml | 2 - test/e2e/functional/success-event.yaml | 2 - .../synchronization-mutex-tmpl-level.yaml | 2 - .../synchronization-mutex-wf-level-1.yaml | 2 - .../synchronization-mutex-wf-level.yaml | 2 - test/e2e/functional_test.go | 82 +++++-------- .../malformed-clusterworkflowtemplate.yaml | 8 -- .../e2e/malformed/malformed-cronworkflow.yaml | 9 -- test/e2e/malformed/malformed-workflow.yaml | 9 -- .../malformed/malformed-workflowtemplate.yaml | 8 -- test/e2e/pod_cleanup_test.go | 10 -- test/e2e/py.go | 40 ++++++ test/e2e/signals_test.go | 8 +- test/e2e/smoke/artifact-passing.yaml | 2 - test/e2e/smoke/basic-2.yaml | 2 - test/e2e/smoke/basic-generate-name.yaml | 2 - test/e2e/smoke/basic.yaml | 2 - ...r-workflow-template-whalesay-template.yaml | 2 +- test/e2e/smoke/hello-world-workflow-tmpl.yaml | 2 - test/e2e/smoke/runasnonroot-workflow.yaml | 2 +- .../workflow-template-whalesay-template.yaml | 2 +- test/e2e/testdata/archive-strategies.yaml | 2 - .../e2e/testdata/artifact-repository-ref.yaml | 2 - .../basic-clusterworkflowtemplate.yaml | 4 +- test/e2e/testdata/basic-cronworkflow.yaml | 6 +- test/e2e/testdata/basic-workflow.yaml | 2 - test/e2e/testdata/basic-workflowtemplate.yaml | 4 +- ...ter-workflow-template-nested-template.yaml | 2 - .../cluster-workflow-template-ref.yaml | 2 - test/e2e/testdata/exit-1.yaml | 2 - test/e2e/testdata/input-artifacts.yaml | 2 - .../e2e/testdata/input-on-mount-workflow.yaml | 2 - test/e2e/testdata/log-problems.yaml | 2 - .../malformed-clusterworkflowtemplate.yaml | 2 +- .../malformed/malformed-cronworkflow.yaml | 2 +- .../malformed/malformed-workflow.yaml | 2 +- .../malformed/malformed-workflowtemplate.yaml | 2 +- test/e2e/testdata/node-suspend.yaml | 2 - ...ifact-with-s3-bucket-creation-enabled.yaml | 2 - .../testdata/output-on-input-workflow.yaml | 2 - .../testdata/output-on-mount-workflow.yaml | 2 - test/e2e/testdata/pending-workflow.yaml | 2 - test/e2e/testdata/retry-omit.yaml | 2 - test/e2e/testdata/retry-test.yaml | 2 - .../same-input-output-path-optional.yaml | 2 - test/e2e/testdata/semaphore-tmpl-level.yaml | 2 - test/e2e/testdata/semaphore-wf-level-1.yaml | 2 - test/e2e/testdata/semaphore-wf-level.yaml | 2 - test/e2e/testdata/sidecar-workflow.yaml | 2 - test/e2e/testdata/sleep-3s.yaml | 2 - .../sleepy-retry-on-error-workflow.yaml | 2 - test/e2e/testdata/sleepy-workflow.yaml | 2 - test/e2e/testdata/storage-limit.yaml | 2 - test/e2e/testdata/two-items.yaml | 2 - .../wellformed-clusterworkflowtemplate.yaml | 2 +- .../wellformed/wellformed-cronworkflow.yaml | 4 +- ...ow-with-cluster-workflow-template-ref.yaml | 2 +- ...lformed-cluster-workflow-template-ref.yaml | 2 +- ...-with-malformed-workflow-template-ref.yaml | 2 +- ...d-workflow-with-workflow-template-ref.yaml | 2 +- .../wellformed-workflowtemplate.yaml | 2 +- test/e2e/testdata/wf-default-ns.yaml | 8 +- .../workflow-template-nested-template.yaml | 2 - .../workflow-template-ref-exithandler.yaml | 2 - test/e2e/testdata/workflow-template-ref.yaml | 2 - .../workflow-template-with-enum-values.yaml | 2 - .../invalid-workflowtemplate.yaml | 4 +- .../workflow-templates/workflowtemplate.yaml | 4 +- test/e2e/workflow_template_test.go | 6 +- 100 files changed, 488 insertions(+), 443 deletions(-) create mode 100644 examples/output-result-workflow.yaml create mode 100644 test/e2e/examples_test.go create mode 100644 test/e2e/fixtures/print.go delete mode 100644 test/e2e/malformed/malformed-clusterworkflowtemplate.yaml delete mode 100644 test/e2e/malformed/malformed-cronworkflow.yaml delete mode 100644 test/e2e/malformed/malformed-workflow.yaml delete mode 100644 test/e2e/malformed/malformed-workflowtemplate.yaml create mode 100644 test/e2e/py.go diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 8f5071428dd0..48ca96fb638c 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -52,6 +52,8 @@ jobs: include: - test: test-cli containerRuntimeExecutor: docker + - test: test-examples + containerRuntimeExecutor: docker - test: test-functional containerRuntimeExecutor: docker - test: test-e2e-cron diff --git a/.golangci.yml b/.golangci.yml index 66198083c14e..84e737441aef 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,6 +11,7 @@ run: - cli - cron - executor + - examples - functional linters: enable: diff --git a/Makefile b/Makefile index 2c9ed94de6e6..9d101ef65001 100644 --- a/Makefile +++ b/Makefile @@ -484,6 +484,10 @@ test-e2e-cron: test-executor: $(GOTEST) -timeout 5m -count 1 --tags executor -p 1 ./test/e2e +.PHONY: test-examples +test-examples: + $(GOTEST) -timeout 15m -count 1 --tags examples -p 1 ./test/e2e + .PHONY: test-functional test-functional: $(GOTEST) -timeout 15m -count 1 --tags api,functional -p 1 ./test/e2e diff --git a/docs/fields.md b/docs/fields.md index 8e4bcb81a56b..d81c479c0445 100644 --- a/docs/fields.md +++ b/docs/fields.md @@ -168,6 +168,8 @@ Workflow is the definition of a workflow resource - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) @@ -509,6 +511,8 @@ WorkflowSpec is the specification of a Workflow. - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) @@ -868,6 +872,8 @@ CronWorkflowSpec is the specification of a CronWorkflow - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) @@ -1185,6 +1191,8 @@ WorkflowTemplateSpec is a spec of WorkflowTemplate. - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) @@ -1446,6 +1454,8 @@ Arguments to a template - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) - [`parallelism-nested-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-workflow.yaml) @@ -1820,6 +1830,8 @@ Template is a reusable and composable unit of execution in a workflow - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) @@ -2360,6 +2372,8 @@ Parameter indicate a passed string parameter to a service template with an optio - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) - [`parallelism-nested-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-workflow.yaml) @@ -2588,6 +2602,8 @@ DAGTemplate is a template subtype for directed acyclic graph templates - [`map-reduce.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/map-reduce.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) - [`parameter-aggregation-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parameter-aggregation-dag.yaml) @@ -2752,6 +2768,8 @@ Inputs are the mechanism for passing parameters, artifacts, volumes from one tem - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) - [`parallelism-nested-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-workflow.yaml) @@ -3533,6 +3551,8 @@ MetricLabel is a single label for a prometheus metric - [`hello-world.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/hello-world.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`pod-metadata-wf-field.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/pod-metadata-wf-field.yaml) - [`pod-metadata.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/pod-metadata.yaml) @@ -3594,6 +3614,8 @@ DAGTask represents a node in the graph during DAG execution - [`map-reduce.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/map-reduce.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) - [`parameter-aggregation-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parameter-aggregation-dag.yaml) @@ -3999,6 +4021,8 @@ ObjectMeta is metadata that all persisted resources must have, which includes al - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) @@ -4534,6 +4558,8 @@ A single application container that you want to run within a pod. - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) @@ -5191,6 +5217,8 @@ PersistentVolumeClaimSpec describes the common attributes of storage devices and - [`output-parameter.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-parameter.yaml) +- [`output-result-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/output-result-workflow.yaml) + - [`parallelism-limit.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-limit.yaml) - [`parallelism-nested-dag.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/parallelism-nested-dag.yaml) diff --git a/examples/output-result-workflow.yaml b/examples/output-result-workflow.yaml new file mode 100644 index 000000000000..bd9440e3de38 --- /dev/null +++ b/examples/output-result-workflow.yaml @@ -0,0 +1,43 @@ +# This workflows shows capturing the result code of a workflow. +kind: Workflow +apiVersion: argoproj.io/v1alpha1 +metadata: + generateName: output-result- + labels: + workflows.argoproj.io/test: "true" + annotations: + workflows.argoproj.io/verify.py: | + assert status["phase"] == "Succeeded" + assert nodes["a"]["phase"] == "Succeeded" + assert nodes["a"]["outputs"]["exitCode"] == "0" + assert nodes["a"]["outputs"]["result"] == "foo" +spec: + entrypoint: main + templates: + - name: main + dag: + tasks: + - name: a + arguments: + parameters: + - name: p-0 + value: "foo" + template: pod-0 + - name: b + template: pod-0 + dependencies: + - a + arguments: + parameters: + - name: p-0 + value: "{{tasks.a.outputs.result}}" + - name: pod-0 + inputs: + parameters: + - name: p-0 + container: + image: argoproj/argosay:v2 + args: + - echo + - "{{inputs.parameters.p-0}}" + - /dev/stdout diff --git a/go.mod b/go.mod index 65a930821d06..200c1095817e 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/Azure/go-autorest/autorest v0.11.1 // indirect github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible + github.com/TwinProduction/go-color v0.0.3 github.com/aliyun/aliyun-oss-go-sdk v2.1.5+incompatible github.com/antonmedv/expr v1.8.8 github.com/argoproj/argo-events v1.2.0 @@ -24,6 +25,7 @@ require ( github.com/gavv/httpexpect/v2 v2.0.3 github.com/go-openapi/jsonreference v0.19.5 github.com/go-openapi/spec v0.20.0 + github.com/go-python/gpython v0.0.3 github.com/go-sql-driver/mysql v1.5.0 github.com/go-swagger/go-swagger v0.25.0 github.com/gogo/protobuf v1.3.1 diff --git a/go.sum b/go.sum index a47526574e50..3ee704521089 100644 --- a/go.sum +++ b/go.sum @@ -106,6 +106,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.26.1/go.mod h1:NbSGBSSndYaIhRcBtY9V0U7AyH+x71bG668AuWys/yU= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/TwinProduction/go-color v0.0.3 h1:2asEWaZo0Oh/FCib+KqHmEoideK8fMyX58JujC/dbDA= +github.com/TwinProduction/go-color v0.0.3/go.mod h1:5hWpSyT+mmKPjCwPNEruBW5Dkbs/2PwOuU468ntEXNQ= github.com/UnnoTed/fileb0x v1.1.4/go.mod h1:X59xXT18tdNk/D6j+KZySratBsuKJauMtVuJ9cgOiZs= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/ahmetb/gen-crd-api-reference-docs v0.2.0/go.mod h1:P/XzJ+c2+khJKNKABcm2biRwk2QAuwbLf8DlXuaL7WM= @@ -392,6 +394,8 @@ github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7 github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= github.com/go-openapi/validate v0.19.10 h1:tG3SZ5DC5KF4cyt7nqLVcQXGj5A7mpaYkAcNPlDK+Yk= github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= +github.com/go-python/gpython v0.0.3 h1:QNFZ0h540Lajx7Pi/os06XzzdYUQG+2sV7IvPo/Mvmg= +github.com/go-python/gpython v0.0.3/go.mod h1:bmk0l57W/7Cs67MMnz4U28SoYyvz5NTMYyJvUqytJhs= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= @@ -513,11 +517,13 @@ github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3i github.com/googleapis/gnostic v0.5.1 h1:A8Yhf6EtqTv9RMsU6MQTyrtV1TjWlR6xU9BsZIwuTCM= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherwasm v1.0.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -701,6 +707,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0= github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/goreman v0.3.7 h1:3hllA14FpyJnzR7+u9G25D3lh2OdyC9XZYQE2Axuhto= github.com/mattn/goreman v0.3.7/go.mod h1:9iD9ikyr4bWAUR2Y4INFjl/L83BdBIJPwXwZ6lg5JDk= @@ -800,6 +807,8 @@ github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUr github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw= github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/peterh/liner v1.1.0 h1:f+aAedNJA6uk7+6rXsYBnhdo4Xux7ESLe+kcuVUF5os= +github.com/peterh/liner v1.1.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.4.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.5.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= diff --git a/test/e2e/argo_server_test.go b/test/e2e/argo_server_test.go index 0097632cf307..309b4f058947 100644 --- a/test/e2e/argo_server_test.go +++ b/test/e2e/argo_server_test.go @@ -120,13 +120,11 @@ func (s *ArgoServerSuite) TestSubmitWorkflowTemplateFromGithubWebhook() { WorkflowTemplate(` metadata: name: github-webhook - labels: - argo-e2e: true spec: entrypoint: main workflowMetadata: labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" templates: - name: main container: @@ -135,8 +133,6 @@ spec: WorkflowEventBinding(` metadata: name: github-webhook - labels: - argo-e2e: true spec: event: selector: metadata["x-github-event"] == ["push"] @@ -168,13 +164,11 @@ func (s *ArgoServerSuite) TestSubmitWorkflowTemplateFromEvent() { WorkflowTemplate(` metadata: name: event-consumer - labels: - argo-e2e: true spec: entrypoint: main workflowMetadata: labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" arguments: parameters: - name: salutation @@ -203,8 +197,6 @@ spec: WorkflowEventBinding(` metadata: name: event-consumer - labels: - argo-e2e: true spec: event: selector: payload.appellation != "" && metadata["x-argo-e2e"] == ["true"] @@ -240,13 +232,11 @@ func (s *ArgoServerSuite) TestSubmitClusterWorkflowTemplateFromEvent() { ClusterWorkflowTemplate(` metadata: name: event-consumer - labels: - argo-e2e: true spec: entrypoint: main workflowMetadata: labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" templates: - name: main container: @@ -255,8 +245,6 @@ spec: WorkflowEventBinding(` metadata: name: event-consumer - labels: - argo-e2e: true spec: event: selector: true @@ -287,8 +275,6 @@ func (s *ArgoServerSuite) TestEventOnMalformedWorkflowEventBinding() { WorkflowEventBinding(` metadata: name: malformed - labels: - argo-e2e: true `). When(). CreateWorkflowEventBinding(). @@ -451,7 +437,7 @@ func (s *ArgoServerSuite) TestPermission() { "metadata": { "name": "test-wf-good", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -480,7 +466,7 @@ func (s *ArgoServerSuite) TestPermission() { s.bearerToken = goodToken s.Run("ListWFsGoodToken", func() { s.e().GET("/api/v1/workflows/"+nsName). - WithQuery("listOptions.labelSelector", "argo-e2e"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test"). Expect(). Status(200). JSON(). @@ -500,7 +486,7 @@ func (s *ArgoServerSuite) TestPermission() { "metadata": { "name": "test-wf-bad", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -566,7 +552,7 @@ func (s *ArgoServerSuite) TestPermission() { s.bearerToken = goodToken s.Run("ListArchivedWFsGoodToken", func() { s.e().GET("/api/v1/archived-workflows"). - WithQuery("listOptions.labelSelector", "argo-e2e"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test"). WithQuery("listOptions.fieldSelector", "metadata.namespace="+nsName). Expect(). Status(200). @@ -579,7 +565,7 @@ func (s *ArgoServerSuite) TestPermission() { s.Run("ListArchivedWFsBadToken", func() { s.Need(fixtures.RBAC) s.e().GET("/api/v1/archived-workflows"). - WithQuery("listOptions.labelSelector", "argo-e2e"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test"). WithQuery("listOptions.fieldSelector", "metadata.namespace="+nsName). Expect(). Status(403) @@ -589,7 +575,7 @@ func (s *ArgoServerSuite) TestPermission() { s.bearerToken = goodToken s.Run("GetArchivedWFsGoodToken", func() { s.e().GET("/api/v1/archived-workflows/"+uid). - WithQuery("listOptions.labelSelector", "argo-e2e"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test"). Expect(). Status(200) }) @@ -630,7 +616,7 @@ func (s *ArgoServerSuite) TestLintWorkflow() { "metadata": { "name": "test", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -658,7 +644,7 @@ func (s *ArgoServerSuite) TestHintWhenWorkflowExists() { "metadata": { "name": "hint", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -683,7 +669,7 @@ func (s *ArgoServerSuite) TestHintWhenWorkflowExists() { "metadata": { "name": "hint", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -715,7 +701,7 @@ func (s *ArgoServerSuite) TestCreateWorkflowDryRun() { "metadata": { "name": "test", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -749,7 +735,7 @@ func (s *ArgoServerSuite) TestWorkflowService() { "metadata": { "generateName": "test-", "labels": { - "argo-e2e": "subject" + "workflows.argoproj.io/test": "subject" } }, "spec": { @@ -781,7 +767,7 @@ func (s *ArgoServerSuite) TestWorkflowService() { s.Run("List", func() { j := s.e().GET("/api/v1/workflows/argo"). - WithQuery("listOptions.labelSelector", "argo-e2e=subject"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test=subject"). Expect(). Status(200). JSON() @@ -796,7 +782,7 @@ func (s *ArgoServerSuite) TestWorkflowService() { s.Run("ListWithFields", func() { j := s.e().GET("/api/v1/workflows/argo"). - WithQuery("listOptions.labelSelector", "argo-e2e=subject"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test=subject"). WithQuery("fields", "-items.status.nodes,items.status.finishedAt,items.status.startedAt"). Expect(). Status(200). @@ -907,7 +893,7 @@ func (s *ArgoServerSuite) TestCronWorkflowService() { "metadata": { "name": "test", "labels": { - "argo-e2e": "subject" + "workflows.argoproj.io/test": "subject" } }, "spec": { @@ -957,17 +943,12 @@ func (s *ArgoServerSuite) TestCronWorkflowService() { kind: CronWorkflow metadata: name: test-cron-wf-basic - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Allow" startingDeadlineSeconds: 0 successfulJobsHistoryLimit: 4 failedJobsHistoryLimit: 2 - workflowMetadata: - labels: - argo-e2e: true workflowSpec: podGC: strategy: OnPodCompletion @@ -982,7 +963,7 @@ spec: `) s.e().GET("/api/v1/cron-workflows/argo"). - WithQuery("listOptions.labelSelector", "argo-e2e=subject"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test=subject"). Expect(). Status(200). JSON(). @@ -1013,13 +994,13 @@ spec: "name": "test", "resourceVersion": "` + resourceVersion + `", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { "schedule": "1 * * * *", "workflowMetadata": { - "labels": {"argo-e2e": "true"} + "labels": {"workflows.argoproj.io/test": "true"} }, "workflowSpec": { "entrypoint": "whalesay", @@ -1058,7 +1039,7 @@ func (s *ArgoServerSuite) TestArtifactServer() { Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToBeArchived, "to be archived"). + WaitForWorkflow(fixtures.ToBeArchived). Then(). ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { name = metadata.Name @@ -1139,7 +1120,7 @@ func (s *ArgoServerSuite) TestWorkflowServiceStream() { Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). Then(). ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { name = metadata.Name @@ -1193,7 +1174,6 @@ func (s *ArgoServerSuite) TestArchivedWorkflowService() { metadata: name: archie labels: - argo-e2e: true foo: 1 spec: entrypoint: run-archie @@ -1213,7 +1193,6 @@ spec: metadata: name: betty labels: - argo-e2e: true foo: 2 spec: entrypoint: run-betty @@ -1223,7 +1202,7 @@ spec: image: argoproj/argosay:v2`). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToBeArchived, "to be archived") + WaitForWorkflow(fixtures.ToBeArchived) for _, tt := range []struct { name string @@ -1245,7 +1224,7 @@ spec: s.Run(tt.name, func() { path := s.e().GET("/api/v1/archived-workflows"). WithQuery("listOptions.fieldSelector", "metadata.namespace=argo"). - WithQuery("listOptions.labelSelector", "argo-e2e,"+tt.selector). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test,"+tt.selector). Expect(). Status(200). JSON(). @@ -1263,7 +1242,7 @@ spec: s.Run("ListWithLimitAndOffset", func() { j := s.e().GET("/api/v1/archived-workflows"). - WithQuery("listOptions.labelSelector", "argo-e2e"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test"). WithQuery("listOptions.fieldSelector", "metadata.namespace=argo"). WithQuery("listOptions.limit", 1). WithQuery("listOptions.offset", 1). @@ -1283,7 +1262,7 @@ spec: s.Run("ListWithMinStartedAtGood", func() { fieldSelector := "metadata.namespace=argo,spec.startedAt>" + time.Now().Add(-1*time.Hour).Format(time.RFC3339) + ",spec.startedAt<" + time.Now().Add(1*time.Hour).Format(time.RFC3339) s.e().GET("/api/v1/archived-workflows"). - WithQuery("listOptions.labelSelector", "argo-e2e"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test"). WithQuery("listOptions.fieldSelector", fieldSelector). WithQuery("listOptions.limit", 2). Expect(). @@ -1297,7 +1276,7 @@ spec: s.Run("ListWithMinStartedAtBad", func() { s.e().GET("/api/v1/archived-workflows"). - WithQuery("listOptions.labelSelector", "argo-e2e"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test"). WithQuery("listOptions.fieldSelector", "metadata.namespace=argo,spec.startedAt>"+time.Now().Add(1*time.Hour).Format(time.RFC3339)). WithQuery("listOptions.limit", 2). Expect(). @@ -1336,7 +1315,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() { "metadata": { "name": "test", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -1365,7 +1344,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() { "metadata": { "name": "test", "labels": { - "argo-e2e": "subject" + "workflows.argoproj.io/test": "subject" } }, "spec": { @@ -1395,7 +1374,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() { CreateWorkflowTemplates() s.e().GET("/api/v1/workflow-templates/argo"). - WithQuery("listOptions.labelSelector", "argo-e2e=subject"). + WithQuery("listOptions.labelSelector", "workflows.argoproj.io/test=subject"). Expect(). Status(200). JSON(). @@ -1427,7 +1406,7 @@ func (s *ArgoServerSuite) TestWorkflowTemplateService() { "name": "test", "resourceVersion": "` + resourceVersion + `", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -1467,7 +1446,7 @@ func (s *ArgoServerSuite) TestSubmitWorkflowFromResource() { "metadata": { "name": "test", "labels": { - "argo-e2e": "subject" + "workflows.argoproj.io/test": "subject" } }, "spec": { @@ -1493,7 +1472,7 @@ func (s *ArgoServerSuite) TestSubmitWorkflowFromResource() { "resourceKind": "WorkflowTemplate", "resourceName": "test", "submitOptions": { - "labels": "argo-e2e=true" + "labels": "workflows.argoproj.io/test=true" } }`)). Expect(). @@ -1507,7 +1486,7 @@ func (s *ArgoServerSuite) TestSubmitWorkflowFromResource() { "metadata": { "name": "test", "labels": { - "argo-e2e": "subject" + "workflows.argoproj.io/test": "subject" } }, "spec": { @@ -1536,7 +1515,7 @@ func (s *ArgoServerSuite) TestSubmitWorkflowFromResource() { "resourceKind": "cronworkflow", "resourceName": "test", "submitOptions": { - "labels": "argo-e2e=true" + "labels": "workflows.argoproj.io/test=true" } }`)). Expect(). @@ -1550,7 +1529,7 @@ func (s *ArgoServerSuite) TestSubmitWorkflowFromResource() { "metadata": { "name": "test", "labels": { - "argo-e2e": "subject" + "workflows.argoproj.io/test": "subject" } }, "spec": { @@ -1576,7 +1555,7 @@ func (s *ArgoServerSuite) TestSubmitWorkflowFromResource() { "resourceKind": "ClusterWorkflowTemplate", "resourceName": "test", "submitOptions": { - "labels": "argo-e2e=true" + "labels": "workflows.argoproj.io/test=true" } }`)). Expect(). @@ -1593,7 +1572,7 @@ func (s *ArgoServerSuite) TestEventSourcesService() { "metadata": { "name": "test-event-source", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -1657,7 +1636,7 @@ func (s *ArgoServerSuite) TestEventSourcesService() { "name": "test-event-source", "resourceVersion": "` + resourceVersion + `", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { @@ -1689,7 +1668,7 @@ func (s *ArgoServerSuite) TestSensorService() { "metadata":{ "name":"test-sensor", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec":{ @@ -1763,7 +1742,7 @@ func (s *ArgoServerSuite) TestSensorService() { "name":"test-sensor", "resourceVersion": "` + resourceVersion + `", "labels": { - "argo-e2e": "true" + "workflows.argoproj.io/test": "true" } }, "spec": { diff --git a/test/e2e/artifacts_test.go b/test/e2e/artifacts_test.go index 1a8be79da7f5..434a76a413c4 100644 --- a/test/e2e/artifacts_test.go +++ b/test/e2e/artifacts_test.go @@ -76,8 +76,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: default-params - labels: - argo-e2e: true spec: entrypoint: start templates: diff --git a/test/e2e/cli_test.go b/test/e2e/cli_test.go index f34e7b1d948e..3547c1ad856d 100644 --- a/test/e2e/cli_test.go +++ b/test/e2e/cli_test.go @@ -189,7 +189,7 @@ func (s *CLISuite) TestVersion() { func (s *CLISuite) TestSubmitDryRun() { s.Given(). - RunCli([]string{"submit", "smoke/basic.yaml", "--dry-run", "-o", "yaml"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "smoke/basic.yaml", "--dry-run", "-o", "yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "generateName: basic") // dry-run should never get a UID @@ -200,7 +200,7 @@ func (s *CLISuite) TestSubmitDryRun() { func (s *CLISuite) TestSubmitServerDryRun() { s.Given(). - RunCli([]string{"submit", "smoke/basic.yaml", "--server-dry-run", "-o", "yaml"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "smoke/basic.yaml", "--server-dry-run", "-o", "yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "name: basic") // server-dry-run should get a UID @@ -237,10 +237,10 @@ func (s *CLISuite) TestLogs() { Workflow(`@smoke/basic.yaml`). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.Nodes.FindByDisplayName(wf.Name) != nil - }), "pod running", 10*time.Second). + WaitForWorkflow(fixtures.ToStart). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Nodes.FindByDisplayName(wf.Name) != nil, "pod running" + }), 10*time.Second). Then(). ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { name = metadata.Name @@ -315,7 +315,7 @@ func (s *CLISuite) TestLogProblems() { Workflow(`@testdata/log-problems.yaml`). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). Then(). // logs should come in order RunCli([]string{"logs", "@latest", "--follow"}, func(t *testing.T, output string, err error) { @@ -350,7 +350,7 @@ func (s *CLISuite) TestLogProblems() { func (s *CLISuite) TestRoot() { s.Run("Submit", func() { - s.Given().RunCli([]string{"submit", "testdata/basic-workflow.yaml"}, func(t *testing.T, output string, err error) { + s.Given().RunCli([]string{"submit", "testdata/basic-workflow.yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "Name:") assert.Contains(t, output, "Namespace:") @@ -397,7 +397,7 @@ func (s *CLISuite) TestRoot() { s.Given().CronWorkflow("@cron/basic.yaml"). When(). CreateCronWorkflow(). - RunCli([]string{"submit", "--from", "cronwf/test-cron-wf-basic", "-l", "argo-e2e=true"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "--from", "cronwf/test-cron-wf-basic", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) assert.Contains(t, output, "Name: test-cron-wf-basic-") r := regexp.MustCompile(`Name:\s+?(test-cron-wf-basic-[a-z0-9]+)`) @@ -421,7 +421,7 @@ func (s *CLISuite) TestWorkflowSuspendResume() { Workflow("@testdata/sleep-3s.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). RunCli([]string{"suspend", "sleep-3s"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "workflow sleep-3s suspended") @@ -445,25 +445,25 @@ func (s *CLISuite) TestNodeSuspendResume() { Workflow("@testdata/node-suspend.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.AnyActiveSuspendNode() - }), "suspended node"). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.AnyActiveSuspendNode(), "suspended node" + })). RunCli([]string{"resume", "node-suspend", "--node-field-selector", "inputs.parameters.tag.value=suspend1-tag1"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "workflow node-suspend resumed") } }). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.AnyActiveSuspendNode() - }), "suspended node"). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.AnyActiveSuspendNode(), "suspended node" + })). RunCli([]string{"stop", "node-suspend", "--node-field-selector", "inputs.parameters.tag.value=suspend2-tag1", "--message", "because"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "workflow node-suspend stopped") } }). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.Phase == wfv1.WorkflowFailed - }), "suspended node"). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Phase == wfv1.WorkflowFailed, "suspended node" + })). Then(). ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { if assert.Equal(t, wfv1.WorkflowFailed, status.Phase) { @@ -547,7 +547,7 @@ func (s *CLISuite) TestWorkflowDeleteAll() { When(). SubmitWorkflow(). Given(). - RunCli([]string{"delete", "--all", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--all", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Regexp(t, "Workflow 'basic-.*' deleted", output) } @@ -560,7 +560,7 @@ func (s *CLISuite) TestWorkflowDeleteCompleted() { When(). SubmitWorkflow(). Given(). - RunCli([]string{"delete", "--completed", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--completed", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { // nothing should be deleted yet assert.NotContains(t, output, "deleted") @@ -569,7 +569,7 @@ func (s *CLISuite) TestWorkflowDeleteCompleted() { When(). WaitForWorkflow(). Given(). - RunCli([]string{"delete", "--completed", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--completed", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "deleted") } @@ -594,7 +594,7 @@ func (s *CLISuite) TestWorkflowDeleteResubmitted() { }). When(). Given(). - RunCli([]string{"delete", "--resubmitted", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--resubmitted", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "deleted") } @@ -608,13 +608,13 @@ func (s *CLISuite) TestWorkflowDeleteOlder() { SubmitWorkflow(). WaitForWorkflow(). Given(). - RunCli([]string{"delete", "--older", "1d", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--older", "1d", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { // nothing over a day should be deleted assert.NotContains(t, output, "deleted") } }). - RunCli([]string{"delete", "--older", "0s", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--older", "0s", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "deleted") } @@ -627,13 +627,13 @@ func (s *CLISuite) TestWorkflowDeleteByPrefix() { When(). SubmitWorkflow(). Given(). - RunCli([]string{"delete", "--prefix", "missing-prefix", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--prefix", "missing-prefix", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { // nothing should be deleted assert.NotContains(t, output, "deleted") } }). - RunCli([]string{"delete", "--prefix", "basic", "-l", "argo-e2e"}, func(t *testing.T, output string, err error) { + RunCli([]string{"delete", "--prefix", "basic", "-l", "workflows.argoproj.io/test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "deleted") } @@ -737,19 +737,19 @@ func (s *CLISuite) TestWorkflowRetry() { Workflow("@testdata/retry-test.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.AnyActiveSuspendNode() - }), "suspended node"). + WaitForWorkflow(fixtures.ToStart). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.AnyActiveSuspendNode(), "suspended node" + })). RunCli([]string{"terminate", "retry-test"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "workflow retry-test terminated") } }). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { retryTime = wf.Status.FinishedAt - return wf.Status.Phase == wfv1.WorkflowFailed - }), "is terminated", 20*time.Second). + return wf.Status.Phase == wfv1.WorkflowFailed, "is terminated" + }), 20*time.Second). Wait(3*time.Second). RunCli([]string{"retry", "retry-test", "--restart-successful", "--node-field-selector", "templateName==steps-inner"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err, output) { @@ -757,9 +757,9 @@ func (s *CLISuite) TestWorkflowRetry() { assert.Contains(t, output, "Namespace:") } }). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.AnyActiveSuspendNode() - }), "suspended node"). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.AnyActiveSuspendNode(), "suspended node" + })). Then(). ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { outerStepsPodNode := status.Nodes.FindByDisplayName("steps-outer-step1") @@ -804,7 +804,7 @@ func (s *CLISuite) TestWorkflowTerminateBySelector() { Workflow("@testdata/basic-workflow.yaml"). When(). SubmitWorkflow(). - RunCli([]string{"terminate", "--selector", "argo-e2e=true"}, func(t *testing.T, output string, err error) { + RunCli([]string{"terminate", "--selector", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Regexp(t, "workflow basic terminated", output) } @@ -908,7 +908,7 @@ func (s *CLISuite) TestTemplate() { }) s.Run("Submittable-Template", func() { s.Need(Offloading) - s.Given().RunCli([]string{"submit", "--from", "workflowtemplate/workflow-template-whalesay-template", "-l", "argo-e2e=true"}, func(t *testing.T, output string, err error) { + s.Given().RunCli([]string{"submit", "--from", "workflowtemplate/workflow-template-whalesay-template", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "Name:") assert.Contains(t, output, "Namespace:") @@ -1020,7 +1020,7 @@ func (s *CLISuite) TestCron() { }) s.Run("Create Schedule Override", func() { - s.Given().RunCli([]string{"cron", "create", "cron/basic.yaml", "--schedule", "1 2 3 * *"}, func(t *testing.T, output string, err error) { + s.Given().RunCli([]string{"cron", "create", "cron/basic.yaml", "--schedule", "1 2 3 * *", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "Schedule: 1 2 3 * *") } @@ -1028,7 +1028,7 @@ func (s *CLISuite) TestCron() { }) s.Run("Create Parameter Override", func() { - s.Given().RunCli([]string{"cron", "create", "cron/param.yaml", "-p", "message=\"bar test passed\""}, func(t *testing.T, output string, err error) { + s.Given().RunCli([]string{"cron", "create", "cron/param.yaml", "-p", "message=\"bar test passed\"", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "bar test passed") } @@ -1125,7 +1125,7 @@ func (s *CLISuite) TestWorkflowTemplateRefSubmit() { }) }) s.Run("CreateWF", func() { - s.Given().RunCli([]string{"submit", "testdata/workflow-template-ref.yaml"}, func(t *testing.T, output string, err error) { + s.Given().RunCli([]string{"submit", "testdata/workflow-template-ref.yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "Name:") assert.Contains(t, output, "Namespace:") @@ -1142,7 +1142,7 @@ func (s *CLISuite) TestWorkflowTemplateRefSubmit() { }) }) s.Run("CreateWFWithCWFTRef", func() { - s.Given().RunCli([]string{"submit", "testdata/cluster-workflow-template-ref.yaml"}, func(t *testing.T, output string, err error) { + s.Given().RunCli([]string{"submit", "testdata/cluster-workflow-template-ref.yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "Name:") assert.Contains(t, output, "Namespace:") @@ -1161,15 +1161,15 @@ func (s *CLISuite) TestWorkflowLevelSemaphore() { Workflow("@testdata/semaphore-wf-level.yaml"). When(). CreateConfigMap("my-config", semaphoreData). - RunCli([]string{"submit", "testdata/semaphore-wf-level-1.yaml"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "testdata/semaphore-wf-level-1.yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { if assert.NoError(t, err) { assert.Contains(t, output, "semaphore-wf-level-1") } }). SubmitWorkflow(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.Phase == wfv1.WorkflowUnknown - }), "Workflow is waiting for lock"). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Phase == wfv1.WorkflowUnknown, "Workflow is waiting for lock" + })). WaitForWorkflow(). DeleteConfigMap("my-config"). Then(). @@ -1189,9 +1189,9 @@ func (s *CLISuite) TestTemplateLevelSemaphore() { When(). CreateConfigMap("my-config", semaphoreData). SubmitWorkflow(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.Phase == wfv1.WorkflowRunning - }), "waiting for Workflow to run", 10*time.Second). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Phase == wfv1.WorkflowRunning, "waiting for Workflow to run" + }), 10*time.Second). RunCli([]string{"get", "semaphore-tmpl-level"}, func(t *testing.T, output string, err error) { assert.Contains(t, output, "Waiting for") }). @@ -1204,11 +1204,11 @@ func (s *CLISuite) TestRetryOmit() { Workflow("@testdata/retry-omit.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { return wf.Status.Nodes.Any(func(node wfv1.NodeStatus) bool { return node.Phase == wfv1.NodeOmitted - }) - }), "any node omitted"). + }), "any node omitted" + })). WaitForWorkflow(). Then(). ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { @@ -1231,7 +1231,7 @@ func (s *CLISuite) TestResourceTemplateStopAndTerminate() { s.Given(). WorkflowName("resource-tmpl-wf"). When(). - RunCli([]string{"submit", "functional/resource-template.yaml"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "functional/resource-template.yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { assert.Contains(t, output, "Pending") }). WaitForWorkflow(fixtures.ToBeRunning). @@ -1253,7 +1253,7 @@ func (s *CLISuite) TestResourceTemplateStopAndTerminate() { s.Given(). WorkflowName("resource-tmpl-wf-1"). When(). - RunCli([]string{"submit", "functional/resource-template.yaml", "--name", "resource-tmpl-wf-1"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "functional/resource-template.yaml", "--name", "resource-tmpl-wf-1", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { assert.Contains(t, output, "Pending") }). WaitForWorkflow(fixtures.ToBeRunning). @@ -1308,7 +1308,7 @@ func (s *CLISuite) TestArchive() { Workflow("@smoke/basic.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToBeArchived, "to be archived"). + WaitForWorkflow(fixtures.ToBeArchived). Then(). ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { uid = metadata.UID @@ -1361,8 +1361,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: suspend-template - labels: - argo-e2e: true spec: entrypoint: suspend templates: @@ -1400,7 +1398,7 @@ spec: `). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). RunCli([]string{"resume", "suspend-template"}, func(t *testing.T, output string, err error) { assert.Error(t, err) assert.Contains(t, output, "has not been set and does not have a default value") diff --git a/test/e2e/cluster_workflow_template_test.go b/test/e2e/cluster_workflow_template_test.go index 011bf0849133..d858074d236b 100644 --- a/test/e2e/cluster_workflow_template_test.go +++ b/test/e2e/cluster_workflow_template_test.go @@ -23,7 +23,7 @@ func (s *ClusterWorkflowTemplateSuite) TestSubmitClusterWorkflowTemplate() { WorkflowName("my-wf"). When(). CreateClusterWorkflowTemplates(). - RunCli([]string{"submit", "--from", "clusterworkflowtemplate/cluster-workflow-template-whalesay-template", "--name", "my-wf", "-l", "argo-e2e=true"}, func(t *testing.T, output string, err error) { + 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(). @@ -47,8 +47,6 @@ kind: Workflow metadata: name: cwft-wf namespace: argo - labels: - argo-e2e: true spec: entrypoint: whalesay templates: diff --git a/test/e2e/cron/basic.yaml b/test/e2e/cron/basic.yaml index 614d781dc7fe..5e4dac70e0ac 100644 --- a/test/e2e/cron/basic.yaml +++ b/test/e2e/cron/basic.yaml @@ -3,7 +3,7 @@ kind: CronWorkflow metadata: name: test-cron-wf-basic labels: - argo-e2e: true + workflows.argoproj.io/test: "true" spec: schedule: "* * * * *" concurrencyPolicy: "Allow" @@ -12,7 +12,7 @@ spec: failedJobsHistoryLimit: 2 workflowMetadata: labels: - argo-e2e: true + workflows.argoproj.io/test: "true" workflowSpec: entrypoint: whalesay templates: diff --git a/test/e2e/cron/param.yaml b/test/e2e/cron/param.yaml index b74e50f45d2a..42e7d8a58f28 100644 --- a/test/e2e/cron/param.yaml +++ b/test/e2e/cron/param.yaml @@ -3,7 +3,7 @@ kind: CronWorkflow metadata: name: test-cron-wf-basic-param labels: - argo-e2e: true + workflows.argoproj.io/test: "true" spec: schedule: "* * * * *" concurrencyPolicy: "Allow" @@ -12,7 +12,7 @@ spec: failedJobsHistoryLimit: 2 workflowMetadata: labels: - argo-e2e: true + workflows.argoproj.io/test: "true" workflowSpec: entrypoint: whalesay arguments: diff --git a/test/e2e/cron_test.go b/test/e2e/cron_test.go index 9165baf6d39a..946b6dfad465 100644 --- a/test/e2e/cron_test.go +++ b/test/e2e/cron_test.go @@ -49,8 +49,6 @@ func (s *CronSuite) TestBasic() { kind: CronWorkflow metadata: name: test-cron-wf-basic - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Allow" @@ -97,8 +95,6 @@ apiVersion: argoproj.io/v1alpha1 kind: CronWorkflow metadata: name: test-cron-wf-basic-timezone - labels: - argo-e2e: true spec: schedule: "%s" timezone: "%s" @@ -126,8 +122,6 @@ spec: kind: CronWorkflow metadata: name: test-cron-wf-basic-suspend - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Allow" @@ -162,8 +156,6 @@ spec: kind: CronWorkflow metadata: name: test-cron-wf-basic-resume - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Allow" @@ -198,8 +190,6 @@ spec: kind: CronWorkflow metadata: name: test-cron-wf-basic-forbid - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Forbid" @@ -234,7 +224,7 @@ kind: CronWorkflow metadata: name: test-cron-wf-basic-allow labels: - argo-e2e: true + spec: schedule: "* * * * *" concurrencyPolicy: "Allow" @@ -267,8 +257,6 @@ spec: kind: CronWorkflow metadata: name: test-cron-wf-basic-replace - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Replace" @@ -306,8 +294,6 @@ spec: kind: CronWorkflow metadata: name: test-cron-wf-succeed-1 - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Forbid" @@ -343,8 +329,6 @@ spec: kind: CronWorkflow metadata: name: test-cron-wf-fail-1 - labels: - argo-e2e: true spec: schedule: "* * * * *" concurrencyPolicy: "Forbid" diff --git a/test/e2e/daemon_pod_test.go b/test/e2e/daemon_pod_test.go index 867ecbdcbc86..660995ab4b27 100644 --- a/test/e2e/daemon_pod_test.go +++ b/test/e2e/daemon_pod_test.go @@ -23,8 +23,6 @@ func (s *DaemonPodSuite) TestWorkflowCompletesIfContainsDaemonPod() { kind: Workflow metadata: generateName: whalesay- - labels: - argo-e2e: true spec: entrypoint: whalesay templates: @@ -48,7 +46,7 @@ spec: `). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToBeSucceeded, "to be succeeded"). + WaitForWorkflow(fixtures.ToBeSucceeded). Then(). ExpectWorkflow(func(t *testing.T, metadata *v1.ObjectMeta, status *v1alpha1.WorkflowStatus) { assert.False(t, status.FinishedAt.IsZero()) diff --git a/test/e2e/examples_test.go b/test/e2e/examples_test.go new file mode 100644 index 000000000000..a2494e9ef56b --- /dev/null +++ b/test/e2e/examples_test.go @@ -0,0 +1,89 @@ +// +build examples + +package e2e + +import ( + "encoding/json" + "io/ioutil" + "strings" + "testing" + + _ "github.com/go-python/gpython/builtin" + "github.com/go-python/gpython/compile" + "github.com/go-python/gpython/py" + "github.com/go-python/gpython/vm" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "sigs.k8s.io/yaml" + + wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo-workflows/v3/test/e2e/fixtures" +) + +type ExamplesSuite struct { + fixtures.E2ESuite +} + +func jsonify(v interface{}) map[string]interface{} { + data, _ := json.Marshal(v) + x := make(map[string]interface{}) + _ = json.Unmarshal(data, &x) + return x +} + +func (s *ExamplesSuite) TestExamples() { + dir, err := ioutil.ReadDir("../../examples") + s.Assert().NoError(err) + for _, info := range dir { + if info.IsDir() || !strings.HasSuffix(info.Name(), ".yaml") { + continue + } + data, err := ioutil.ReadFile("../../examples/" + info.Name()) + s.Assert().NoError(err) + un := &unstructured.Unstructured{} + s.Assert().NoError(yaml.Unmarshal(data, un)) + if un.GetLabels()[fixtures.Label] == "" { + continue + } + s.Run(info.Name(), func() { + s.DeleteResources() + s.Assert().NoError(err) + s.Given(). + Workflow(string(data)). + When(). + SubmitWorkflow(). + WaitForWorkflow(). + Then(). + ExpectWorkflow(func(t *testing.T, m *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { + verify, ok := m.GetAnnotations()[fixtures.VerifyPy] + nodes := wfv1.Nodes{} + for _, n := range status.Nodes { + nodes[n.DisplayName] = n + } + if ok { + x, err := compile.Compile(verify, "", "exec", 0, true) + if assert.NoError(t, err) { + m := py.NewModule("__main__", "", nil, py.StringDict{ + "metadata": obj(jsonify(m)), + "nodes": obj(jsonify(nodes)), + "status": obj(jsonify(status)), + }) + code, ok := x.(*py.Code) + if assert.True(t, ok) { + _, err := vm.EvalCode(code, m.Globals, nil) + assert.NoError(t, err, verify) + } + } + } else { + assert.Equal(t, wfv1.WorkflowSucceeded, status.Phase) + } + }) + }) + } +} + +func TestExamplesSuite(t *testing.T) { + suite.Run(t, new(ExamplesSuite)) +} diff --git a/test/e2e/expectedfailures/failed-step-event.yaml b/test/e2e/expectedfailures/failed-step-event.yaml index e6c0064b9fe3..46aa9e9104ad 100644 --- a/test/e2e/expectedfailures/failed-step-event.yaml +++ b/test/e2e/expectedfailures/failed-step-event.yaml @@ -5,8 +5,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: failed-step-event- - labels: - argo-e2e: true spec: entrypoint: exit templates: diff --git a/test/e2e/expectedfailures/failed-step.yaml b/test/e2e/expectedfailures/failed-step.yaml index 300ee7761790..f250390324af 100644 --- a/test/e2e/expectedfailures/failed-step.yaml +++ b/test/e2e/expectedfailures/failed-step.yaml @@ -5,8 +5,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: failed-step- - labels: - argo-e2e: true spec: entrypoint: failed-step templates: diff --git a/test/e2e/expectedfailures/pod-termination-failure.yaml b/test/e2e/expectedfailures/pod-termination-failure.yaml index 817470a3e3c3..2542fdd3c050 100644 --- a/test/e2e/expectedfailures/pod-termination-failure.yaml +++ b/test/e2e/expectedfailures/pod-termination-failure.yaml @@ -5,8 +5,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: sleeptest- - labels: - argo-e2e: true spec: entrypoint: entry templates: diff --git a/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml b/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml index 67cc83a2ba5b..3cf003ac8a89 100644 --- a/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml +++ b/test/e2e/expectedfailures/volumes-pvc-fail-event.yaml @@ -4,8 +4,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: volumes-pvc-fail-event- - labels: - argo-e2e: true spec: entrypoint: volumes-pvc-example volumeClaimTemplates: diff --git a/test/e2e/fixtures/e2e_suite.go b/test/e2e/fixtures/e2e_suite.go index caef4e0a9980..7537023162af 100644 --- a/test/e2e/fixtures/e2e_suite.go +++ b/test/e2e/fixtures/e2e_suite.go @@ -27,7 +27,8 @@ import ( const ( Namespace = "argo" - Label = "argo-e2e" + Label = workflow.WorkflowFullName + "/test" // mark this workflow as a test + VerifyPy = workflow.WorkflowFullName + "/verify.py" // python script to run to verify the workflows defaultTimeout = 30 * time.Second ) diff --git a/test/e2e/fixtures/given.go b/test/e2e/fixtures/given.go index cf33eb201387..7e5c0d78b7f3 100644 --- a/test/e2e/fixtures/given.go +++ b/test/e2e/fixtures/given.go @@ -100,6 +100,12 @@ func (g *Given) checkImages(templates []wfv1.Template) { func (g *Given) checkLabels(m metav1.Object) { g.t.Helper() + if m.GetLabels() == nil { + m.SetLabels(map[string]string{}) + } + if m.GetLabels()[Label] == "" { + m.GetLabels()[Label] = "true" + } if m.GetLabels()[Label] == "" { g.t.Fatalf("%s%s does not have %s label", m.GetName(), m.GetGenerateName(), Label) } diff --git a/test/e2e/fixtures/print.go b/test/e2e/fixtures/print.go new file mode 100644 index 000000000000..f464226e1b41 --- /dev/null +++ b/test/e2e/fixtures/print.go @@ -0,0 +1,44 @@ +package fixtures + +import ( + "fmt" + "os" + "text/tabwriter" + "time" + + "github.com/TwinProduction/go-color" + + wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" +) + +var workflowPhaseIcon = map[wfv1.WorkflowPhase]string{ + wfv1.WorkflowPending: color.Ize(color.Yellow, "◷"), + wfv1.WorkflowRunning: color.Ize(color.Blue, "●"), + wfv1.WorkflowSucceeded: color.Ize(color.Green, "✔"), + wfv1.WorkflowFailed: color.Ize(color.Red, "✖"), + wfv1.WorkflowError: color.Ize(color.Red, "⚠"), +} + +var nodePhaseIcon = map[wfv1.NodePhase]string{ + wfv1.NodePending: color.Ize(color.Yellow, "◷"), + wfv1.NodeRunning: color.Ize(color.Blue, "●"), + wfv1.NodeSucceeded: color.Ize(color.Green, "✔"), + wfv1.NodeSkipped: color.Ize(color.Gray, "○"), + wfv1.NodeFailed: color.Ize(color.Red, "✖"), + wfv1.NodeError: color.Ize(color.Red, "⚠"), +} + +func printWorkflow(wf *wfv1.Workflow) { + println(fmt.Sprintf("%-20s %s", "Name:", wf.Name)) + println(fmt.Sprintf("%-18s %v %s", "Phase:", workflowPhaseIcon[wf.Status.Phase], wf.Status.Phase)) + println(fmt.Sprintf("%-20s %s", "Message:", wf.Status.Message)) + println(fmt.Sprintf("%-20s %s", "Duration:", time.Since(wf.Status.StartedAt.Time).Truncate(time.Second))) + println() + + w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0) + for _, n := range wf.Status.Nodes { + _, _ = fmt.Fprintf(w, " %s %s\t%s\t%s\t%s\n", nodePhaseIcon[n.Phase], n.Name, n.TemplateName, time.Since(n.StartedAt.Time).Truncate(time.Second), n.Message) + } + _ = w.Flush() + println() +} diff --git a/test/e2e/fixtures/when.go b/test/e2e/fixtures/when.go index 29ec362379bb..3a98b756ab70 100644 --- a/test/e2e/fixtures/when.go +++ b/test/e2e/fixtures/when.go @@ -2,9 +2,9 @@ package fixtures import ( "context" + "fmt" "reflect" "strconv" - "strings" "testing" "time" @@ -163,30 +163,38 @@ func (w *When) CreateCronWorkflow() *When { return w } -type Condition func(wf *wfv1.Workflow) bool +type Condition func(wf *wfv1.Workflow) (bool, string) var ( - ToBeCompleted Condition = func(wf *wfv1.Workflow) bool { return wf.Labels[common.LabelKeyCompleted] == "true" } - ToStart Condition = func(wf *wfv1.Workflow) bool { return !wf.Status.StartedAt.IsZero() } - ToBeRunning Condition = func(wf *wfv1.Workflow) bool { + ToBeCompleted Condition = func(wf *wfv1.Workflow) (bool, string) { + return wf.Labels[common.LabelKeyCompleted] == "true", "to be completed" + } + ToStart Condition = func(wf *wfv1.Workflow) (bool, string) { return !wf.Status.StartedAt.IsZero(), "to start" } + ToBeRunning Condition = func(wf *wfv1.Workflow) (bool, string) { return wf.Status.Nodes.Any(func(node wfv1.NodeStatus) bool { return node.Phase == wfv1.NodeRunning - }) + }), "to be running" } ) -var ToBeSucceeded Condition = func(wf *wfv1.Workflow) bool { return wf.Status.Phase == wfv1.WorkflowSucceeded } + +var ToBeSucceeded Condition = func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Phase == wfv1.WorkflowSucceeded, "to be succeeded" +} // `ToBeDone` replaces `ToFinish` which also makes sure the workflow is both complete not pending archiving. // This additional check is not needed for most use case, however in `AfterTest` we delete the workflow and this // creates a lot of warning messages in the logs that are cause by misuse rather than actual problems. -var ToBeDone Condition = func(wf *wfv1.Workflow) bool { - return ToBeCompleted(wf) && wf.Labels[common.LabelKeyWorkflowArchivingStatus] != "Pending" +var ToBeDone Condition = func(wf *wfv1.Workflow) (bool, string) { + toBeCompleted, _ := ToBeCompleted(wf) + return toBeCompleted && wf.Labels[common.LabelKeyWorkflowArchivingStatus] != "Pending", "to be done" } -var ToBeArchived Condition = func(wf *wfv1.Workflow) bool { return wf.Labels[common.LabelKeyWorkflowArchivingStatus] == "Archived" } +var ToBeArchived Condition = func(wf *wfv1.Workflow) (bool, string) { + return wf.Labels[common.LabelKeyWorkflowArchivingStatus] == "Archived", "to be archived" +} -var ToBeWaitingOnAMutex Condition = func(wf *wfv1.Workflow) bool { - return wf.Status.Synchronization != nil && wf.Status.Synchronization.Mutex != nil +var ToBeWaitingOnAMutex Condition = func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Synchronization != nil && wf.Status.Synchronization.Mutex != nil, "to be waiting on a mutub" } // Wait for a workflow to meet a condition: @@ -204,17 +212,12 @@ func (w *When) WaitForWorkflow(options ...interface{}) *When { workflowName = w.wf.Name } condition := ToBeDone - message := "to be done" for _, opt := range options { switch v := opt.(type) { case time.Duration: timeout = v case string: - if strings.Contains(v, " ") { - message = v - } else { - workflowName = v - } + workflowName = v case Condition: condition = v default: @@ -229,7 +232,7 @@ func (w *When) WaitForWorkflow(options ...interface{}) *When { fieldSelector = "metadata.name=" + workflowName } - println("Waiting", timeout.String(), "for workflow", fieldSelector, message) + println("Waiting", timeout.String(), "for workflow", fieldSelector) ctx := context.Background() opts := metav1.ListOptions{LabelSelector: Label, FieldSelector: fieldSelector} @@ -249,21 +252,22 @@ func (w *When) WaitForWorkflow(options ...interface{}) *When { wf, ok := event.Object.(*wfv1.Workflow) if ok { w.hydrateWorkflow(wf) - if condition(wf) { - println("Condition met after", time.Since(start).Truncate(time.Second).String()) + printWorkflow(wf) + if ok, message := condition(wf); ok { + println(fmt.Sprintf("Condition %q met after %s", message, time.Since(start).Truncate(time.Second))) w.wf = wf return w } // once done the workflow is done, the condition can never be met // rather than wait maybe 30s for something that can never happen - if ToBeDone(wf) { + if ok, _ = ToBeDone(wf); ok { w.t.Fatalf("condition never and cannot be met because the workflow is done") } } else { w.t.Fatal("not ok") } case <-timeoutCh: - w.t.Fatalf("timeout after %v waiting for condition %s", timeout, message) + w.t.Fatalf("timeout after %v waiting for condition", timeout) } } } @@ -369,7 +373,7 @@ func (w *When) createResourceQuota(name string, rl corev1.ResourceList) *When { w.t.Helper() ctx := context.Background() _, err := w.kubeClient.CoreV1().ResourceQuotas(Namespace).Create(ctx, &corev1.ResourceQuota{ - ObjectMeta: metav1.ObjectMeta{Name: name, Labels: map[string]string{"argo-e2e": "true"}}, + ObjectMeta: metav1.ObjectMeta{Name: name, Labels: map[string]string{Label: "true"}}, Spec: corev1.ResourceQuotaSpec{Hard: rl}, }, metav1.CreateOptions{}) if err != nil { diff --git a/test/e2e/functional/continue-on-failed.yaml b/test/e2e/functional/continue-on-failed.yaml index d99df99a24fe..bb35afa36eec 100644 --- a/test/e2e/functional/continue-on-failed.yaml +++ b/test/e2e/functional/continue-on-failed.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: continue-on-fail - labels: - argo-e2e: true spec: entrypoint: workflow-ignore parallelism: 2 diff --git a/test/e2e/functional/dag-depends.yaml b/test/e2e/functional/dag-depends.yaml index 99b47553110b..5cb04d2014e9 100644 --- a/test/e2e/functional/dag-depends.yaml +++ b/test/e2e/functional/dag-depends.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: dag-diamond- - labels: - argo-e2e: true spec: entrypoint: diamond templates: diff --git a/test/e2e/functional/k8s-patch.yaml b/test/e2e/functional/k8s-patch.yaml index 5ff6bb2aa982..44f43e99b6bf 100644 --- a/test/e2e/functional/k8s-patch.yaml +++ b/test/e2e/functional/k8s-patch.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: k8s-patch- - labels: - argo-e2e: "true" spec: entrypoint: patch-pod templates: diff --git a/test/e2e/functional/loops-empty-param.yaml b/test/e2e/functional/loops-empty-param.yaml index af7c73a84e3d..c72ab76a7d00 100644 --- a/test/e2e/functional/loops-empty-param.yaml +++ b/test/e2e/functional/loops-empty-param.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: loops-param-result- - labels: - argo-e2e: true spec: entrypoint: loop-param-result-example templates: diff --git a/test/e2e/functional/param-aggregation.yaml b/test/e2e/functional/param-aggregation.yaml index a01c86d4e8f6..312b72c80c45 100644 --- a/test/e2e/functional/param-aggregation.yaml +++ b/test/e2e/functional/param-aggregation.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: parameter-aggregation- - labels: - argo-e2e: true spec: entrypoint: parameter-aggregation templates: diff --git a/test/e2e/functional/resource-template.yaml b/test/e2e/functional/resource-template.yaml index 23b42e638e62..0f349c8a9e88 100644 --- a/test/e2e/functional/resource-template.yaml +++ b/test/e2e/functional/resource-template.yaml @@ -2,33 +2,32 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: resource-tmpl-wf - labels: - argo-e2e: true spec: entrypoint: main templates: - - name: main - steps: - - - name: a - template: wf1 - - name: wf1 - resource: - action: create - successCondition: status.phase == Test - manifest: | - apiVersion: argoproj.io/v1alpha1 - kind: Workflow - metadata: - generateName: hello-world- - labels: - argo-e2e: true - spec: - entrypoint: whalesay - templates: - - name: whalesay - resources: - requests: - cpu: 3 - container: - image: argoproj/argosay:v2 - args: [echo, ":) Hello Argo!"] + - name: main + steps: + - - name: a + template: wf1 + - name: wf1 + resource: + action: create + successCondition: status.phase == Test + setOwnerReference: true + manifest: | + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + generateName: hello-world- + labels: + workflows.argoproj.io/test: "true" + spec: + entrypoint: whalesay + templates: + - name: whalesay + resources: + requests: + cpu: 3 + container: + image: argoproj/argosay:v2 + args: [echo, ":) Hello Argo!"] diff --git a/test/e2e/functional/stop-terminate-2.yaml b/test/e2e/functional/stop-terminate-2.yaml index c6792000e326..9f33f45e33b5 100644 --- a/test/e2e/functional/stop-terminate-2.yaml +++ b/test/e2e/functional/stop-terminate-2.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: stop-terminate- - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/functional/stop-terminate.yaml b/test/e2e/functional/stop-terminate.yaml index e0ab37e0e5a4..6d0b58867b03 100644 --- a/test/e2e/functional/stop-terminate.yaml +++ b/test/e2e/functional/stop-terminate.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: stop-terminate- - labels: - argo-e2e: true spec: entrypoint: diamond onExit: exit diff --git a/test/e2e/functional/success-event.yaml b/test/e2e/functional/success-event.yaml index 6284969d40d2..8a1ab2ba6320 100644 --- a/test/e2e/functional/success-event.yaml +++ b/test/e2e/functional/success-event.yaml @@ -5,8 +5,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: success-event- - labels: - argo-e2e: true spec: entrypoint: exit templates: diff --git a/test/e2e/functional/synchronization-mutex-tmpl-level.yaml b/test/e2e/functional/synchronization-mutex-tmpl-level.yaml index 74a88f4b70bd..e580ac58aa95 100644 --- a/test/e2e/functional/synchronization-mutex-tmpl-level.yaml +++ b/test/e2e/functional/synchronization-mutex-tmpl-level.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: synchronization-tmpl-level-mutex - labels: - argo-e2e: true spec: entrypoint: synchronization-tmpl-level-example-mutex templates: diff --git a/test/e2e/functional/synchronization-mutex-wf-level-1.yaml b/test/e2e/functional/synchronization-mutex-wf-level-1.yaml index faf3d3456ee2..9d6d4c6c7e97 100644 --- a/test/e2e/functional/synchronization-mutex-wf-level-1.yaml +++ b/test/e2e/functional/synchronization-mutex-wf-level-1.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: synchronization-wf-level-mutex-1 - labels: - argo-e2e: true spec: entrypoint: whalesay synchronization: diff --git a/test/e2e/functional/synchronization-mutex-wf-level.yaml b/test/e2e/functional/synchronization-mutex-wf-level.yaml index b996fc6622b5..3f98adaab9fa 100644 --- a/test/e2e/functional/synchronization-mutex-wf-level.yaml +++ b/test/e2e/functional/synchronization-mutex-wf-level.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: synchronization-wf-level-mutex - labels: - argo-e2e: true spec: entrypoint: whalesay synchronization: diff --git a/test/e2e/functional_test.go b/test/e2e/functional_test.go index 381b7b3eda33..4351d66e5ff0 100644 --- a/test/e2e/functional_test.go +++ b/test/e2e/functional_test.go @@ -42,7 +42,7 @@ func (s *FunctionalSuite) TestDeletingPendingPod() { Workflow("@testdata/pending-workflow.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). Exec("kubectl", []string{"-n", "argo", "delete", "pod", "-l", "workflows.argoproj.io/workflow"}, fixtures.OutputRegexp(`pod "pending-.*" deleted`)). Wait(3*time.Second). // allow 3s for reconcilliation, we'll create a new pod Exec("kubectl", []string{"-n", "argo", "get", "pod", "-l", "workflows.argoproj.io/workflow"}, fixtures.OutputRegexp(`pending-.*Pending`)) @@ -55,7 +55,7 @@ func (s *FunctionalSuite) TestDeletingRunningPodWithOrErrorRetryPolicy() { Workflow("@testdata/sleepy-retry-on-error-workflow.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToBeRunning, "to be running"). + WaitForWorkflow(fixtures.ToBeRunning). Exec("kubectl", []string{"-n", "argo", "delete", "pod", "-l", "workflows.argoproj.io/workflow"}, fixtures.NoError). WaitForWorkflow(). Then(). @@ -74,7 +74,7 @@ func (s *FunctionalSuite) TestSynchronizationWfLevelMutex() { Workflow("@functional/synchronization-mutex-wf-level.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToBeWaitingOnAMutex, "to be waiting on a mutex"). + WaitForWorkflow(fixtures.ToBeWaitingOnAMutex). WaitForWorkflow(). Then(). ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { @@ -87,7 +87,7 @@ func (s *FunctionalSuite) TestTemplateLevelMutex() { Workflow("@functional/synchronization-mutex-tmpl-level.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToBeWaitingOnAMutex, "to be waiting on a mutex"). + WaitForWorkflow(fixtures.ToBeWaitingOnAMutex). WaitForWorkflow(). Then(). ExpectWorkflow(func(t *testing.T, _ *metav1.ObjectMeta, status *wfv1.WorkflowStatus) { @@ -100,8 +100,6 @@ func (s *FunctionalSuite) TestWorkflowTTL() { Workflow(` metadata: generateName: workflow-ttl- - labels: - argo-e2e: true spec: ttlStrategy: secondsAfterCompletion: 0 @@ -141,8 +139,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: continue-on-fail - labels: - argo-e2e: true spec: entrypoint: workflow-ignore parallelism: 2 @@ -198,8 +194,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: continue-on-failed-dag - labels: - argo-e2e: true spec: entrypoint: workflow-ignore parallelism: 2 @@ -403,9 +397,7 @@ func (s *FunctionalSuite) TestPendingRetryWorkflow() { apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: - generateName: pending-retry-workflow- - labels: - argo-e2e: true + generateName: pending-retry-workflow- spec: entrypoint: dag templates: @@ -427,18 +419,18 @@ spec: When(). MemoryQuota("130M"). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { + WaitForWorkflow(fixtures.ToStart). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { a := wf.Status.Nodes.FindByDisplayName("a") b := wf.Status.Nodes.FindByDisplayName("b") - return wfv1.NodePending == a.Phase && wfv1.NodePending == b.Phase - }), "pods pending"). + return wfv1.NodePending == a.Phase && wfv1.NodePending == b.Phase, "pods pending" + })). DeleteMemoryQuota(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { a := wf.Status.Nodes.FindByDisplayName("a") b := wf.Status.Nodes.FindByDisplayName("b") - return wfv1.NodeSucceeded == a.Phase && wfv1.NodeSucceeded == b.Phase - }), "pods succeeded") + return wfv1.NodeSucceeded == a.Phase && wfv1.NodeSucceeded == b.Phase, "pods succeeded" + })) } // 128M is for argo executor @@ -449,8 +441,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: pending-retry-workflow-with-retry-strategy- - labels: - argo-e2e: true spec: entrypoint: dag templates: @@ -474,18 +464,18 @@ spec: When(). MemoryQuota("130M"). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { + WaitForWorkflow(fixtures.ToStart). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { a := wf.Status.Nodes.FindByDisplayName("a(0)") b := wf.Status.Nodes.FindByDisplayName("b(0)") - return wfv1.NodePending == a.Phase && wfv1.NodePending == b.Phase - }), "pods pending"). + return wfv1.NodePending == a.Phase && wfv1.NodePending == b.Phase, "pods pending" + })). DeleteMemoryQuota(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { a := wf.Status.Nodes.FindByDisplayName("a(0)") b := wf.Status.Nodes.FindByDisplayName("b(0)") - return wfv1.NodeSucceeded == a.Phase && wfv1.NodeSucceeded == b.Phase - }), "pods succeeded") + return wfv1.NodeSucceeded == a.Phase && wfv1.NodeSucceeded == b.Phase, "pods succeeded" + })) } func (s *FunctionalSuite) TestParameterAggregation() { @@ -573,8 +563,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: param-ads - labels: - argo-e2e: true spec: entrypoint: whalesay arguments: @@ -610,8 +598,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: param-limit - labels: - argo-e2e: true spec: entrypoint: whalesay arguments: @@ -649,8 +635,6 @@ func (s *FunctionalSuite) TestInvalidCommand() { Workflow(` metadata: generateName: invalid-command- - labels: - argo-e2e: true spec: entrypoint: main templates: @@ -679,10 +663,10 @@ func (s *FunctionalSuite) TestStorageQuotaLimit() { When(). StorageQuota("5Mi"). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return strings.Contains(wf.Status.Message, "Waiting for a PVC to be created") - }), "PVC pending"). + WaitForWorkflow(fixtures.ToStart). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return strings.Contains(wf.Status.Message, "Waiting for a PVC to be created"), "PVC pending" + })). DeleteStorageQuota(). WaitForWorkflow(). Then(). @@ -698,8 +682,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: steps-tmpl-timeout - labels: - argo-e2e: true spec: entrypoint: hello-hello-hello templates: @@ -729,9 +711,9 @@ spec: `). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.Phase == wfv1.WorkflowFailed - }), "Waiting for timeout", 30*time.Second) + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Phase == wfv1.WorkflowFailed, "Waiting for timeout" + }), 30*time.Second) } func (s *FunctionalSuite) TestTemplateLevelTimeoutWithForbidden() { @@ -741,8 +723,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: steps-tmpl-timeout - labels: - argo-e2e: true spec: entrypoint: hello-hello-hello templates: @@ -776,9 +756,9 @@ spec: When(). MemoryQuota("130M"). SubmitWorkflow(). - WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) bool { - return wf.Status.Phase == wfv1.WorkflowFailed - }), "Waiting for timeout", 30*time.Second). + WaitForWorkflow(fixtures.Condition(func(wf *wfv1.Workflow) (bool, string) { + return wf.Status.Phase == wfv1.WorkflowFailed, "Waiting for timeout" + }), 30*time.Second). DeleteMemoryQuota() } @@ -788,8 +768,6 @@ func (s *FunctionalSuite) TestExitCodePNSSleep() { kind: Workflow metadata: name: cond - labels: - argo-e2e: true spec: entrypoint: conditional-example templates: @@ -832,8 +810,6 @@ func (s *FunctionalSuite) TestWorkflowPodSpecPatch() { kind: Workflow metadata: name: basic - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/malformed/malformed-clusterworkflowtemplate.yaml b/test/e2e/malformed/malformed-clusterworkflowtemplate.yaml deleted file mode 100644 index 57ba5af81755..000000000000 --- a/test/e2e/malformed/malformed-clusterworkflowtemplate.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: ClusterWorkflowTemplate -metadata: - name: malformed -spec: - arguments: - parameters: - someParam: "Hello, world!" diff --git a/test/e2e/malformed/malformed-cronworkflow.yaml b/test/e2e/malformed/malformed-cronworkflow.yaml deleted file mode 100644 index 74582e1529c4..000000000000 --- a/test/e2e/malformed/malformed-cronworkflow.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: CronWorkflow -metadata: - name: malformed -spec: - workflowSpec: - arguments: - parameters: - someParam: "Hello, world!" diff --git a/test/e2e/malformed/malformed-workflow.yaml b/test/e2e/malformed/malformed-workflow.yaml deleted file mode 100644 index 294eeeefa65e..000000000000 --- a/test/e2e/malformed/malformed-workflow.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Workflow -metadata: - name: malformed -spec: - entrypoint: no - arguments: - parameters: - someParam: "Hello, world!" diff --git a/test/e2e/malformed/malformed-workflowtemplate.yaml b/test/e2e/malformed/malformed-workflowtemplate.yaml deleted file mode 100644 index 49f7c138ae14..000000000000 --- a/test/e2e/malformed/malformed-workflowtemplate.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: WorkflowTemplate -metadata: - name: malformed -spec: - arguments: - parameters: - someParam: "Hello, world!" diff --git a/test/e2e/pod_cleanup_test.go b/test/e2e/pod_cleanup_test.go index caba6189895c..d9ce82fae4cf 100644 --- a/test/e2e/pod_cleanup_test.go +++ b/test/e2e/pod_cleanup_test.go @@ -26,8 +26,6 @@ func (s *PodCleanupSuite) TestNone() { Workflow(` metadata: generateName: test-pod-cleanup- - labels: - argo-e2e: true spec: entrypoint: main templates: @@ -52,8 +50,6 @@ func (s *PodCleanupSuite) TestOnPodCompletion() { Workflow(` metadata: generateName: test-pod-cleanup-on-pod-success- - labels: - argo-e2e: true spec: podGC: strategy: OnPodCompletion @@ -95,8 +91,6 @@ func (s *PodCleanupSuite) TestOnPodSuccess() { Workflow(` metadata: generateName: test-pod-cleanup-on-pod-success- - labels: - argo-e2e: true spec: podGC: strategy: OnPodSuccess @@ -138,8 +132,6 @@ func (s *PodCleanupSuite) TestOnWorkflowCompletion() { Workflow(` metadata: generateName: test-pod-cleanup-on-workflow-completion- - labels: - argo-e2e: true spec: podGC: strategy: OnWorkflowCompletion @@ -167,8 +159,6 @@ func (s *PodCleanupSuite) TestOnWorkflowSuccess() { Workflow(` metadata: generateName: test-pod-cleanup-on-workflow-success- - labels: - argo-e2e: true spec: podGC: strategy: OnWorkflowSuccess diff --git a/test/e2e/py.go b/test/e2e/py.go new file mode 100644 index 000000000000..13bbce8e53da --- /dev/null +++ b/test/e2e/py.go @@ -0,0 +1,40 @@ +package e2e + +import ( + "reflect" + + "github.com/go-python/gpython/py" +) + +func obj(v interface{}) py.Object { + switch x := v.(type) { + case float64: + return py.Float(x) + case int: + return py.Int(x) + case string: + return py.String(x) + case []interface{}: + return list(x) + case map[string]interface{}: + return dict(x) + default: + panic(reflect.TypeOf(x).String()) + } +} + +func list(v []interface{}) *py.List { + out := py.NewList() + for _, x := range v { + out.Append(obj(x)) + } + return out +} + +func dict(v map[string]interface{}) py.StringDict { + out := py.NewStringDict() + for k, x := range v { + out[k] = obj(x) + } + return out +} diff --git a/test/e2e/signals_test.go b/test/e2e/signals_test.go index 2d5cecd62013..f61c15512a13 100644 --- a/test/e2e/signals_test.go +++ b/test/e2e/signals_test.go @@ -32,7 +32,7 @@ func (s *SignalsSuite) TestStopBehavior() { Workflow("@functional/stop-terminate.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). RunCli([]string{"stop", "@latest"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) assert.Regexp(t, "workflow stop-terminate-.* stopped", output) @@ -61,7 +61,7 @@ func (s *SignalsSuite) TestTerminateBehavior() { Workflow("@functional/stop-terminate.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). RunCli([]string{"terminate", "@latest"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) assert.Regexp(t, "workflow stop-terminate-.* terminated", output) @@ -87,7 +87,7 @@ func (s *SignalsSuite) TestDoNotCreatePodsUnderStopBehavior() { Workflow("@functional/stop-terminate-2.yaml"). When(). SubmitWorkflow(). - WaitForWorkflow(fixtures.ToStart, "to start"). + WaitForWorkflow(fixtures.ToStart). RunCli([]string{"stop", "@latest"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) assert.Regexp(t, "workflow stop-terminate-.* stopped", output) @@ -113,8 +113,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: retry-backoff-2 - labels: - argo-e2e: true spec: entrypoint: retry-backoff templates: diff --git a/test/e2e/smoke/artifact-passing.yaml b/test/e2e/smoke/artifact-passing.yaml index c2b0423f63ed..fbfd70a59f08 100644 --- a/test/e2e/smoke/artifact-passing.yaml +++ b/test/e2e/smoke/artifact-passing.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: artifact-passing- - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/smoke/basic-2.yaml b/test/e2e/smoke/basic-2.yaml index 2848be5f309a..26012a21b088 100644 --- a/test/e2e/smoke/basic-2.yaml +++ b/test/e2e/smoke/basic-2.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: basic-2 - labels: - argo-e2e: true spec: entrypoint: run-workflow templates: diff --git a/test/e2e/smoke/basic-generate-name.yaml b/test/e2e/smoke/basic-generate-name.yaml index f58fc1026861..db40c0b694eb 100644 --- a/test/e2e/smoke/basic-generate-name.yaml +++ b/test/e2e/smoke/basic-generate-name.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: basic- - labels: - argo-e2e: true spec: entrypoint: run-workflow templates: diff --git a/test/e2e/smoke/basic.yaml b/test/e2e/smoke/basic.yaml index c972b27fd44f..7aba766b7615 100644 --- a/test/e2e/smoke/basic.yaml +++ b/test/e2e/smoke/basic.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: basic- - labels: - argo-e2e: true spec: entrypoint: run-workflow templates: diff --git a/test/e2e/smoke/cluster-workflow-template-whalesay-template.yaml b/test/e2e/smoke/cluster-workflow-template-whalesay-template.yaml index 1d64db295c7a..1eeff1dda31e 100644 --- a/test/e2e/smoke/cluster-workflow-template-whalesay-template.yaml +++ b/test/e2e/smoke/cluster-workflow-template-whalesay-template.yaml @@ -3,7 +3,7 @@ kind: ClusterWorkflowTemplate metadata: name: cluster-workflow-template-whalesay-template labels: - argo-e2e: true + workflows.argoproj.io/test: "true" spec: entrypoint: whalesay-template arguments: diff --git a/test/e2e/smoke/hello-world-workflow-tmpl.yaml b/test/e2e/smoke/hello-world-workflow-tmpl.yaml index 3b5d55004560..48399e695b19 100644 --- a/test/e2e/smoke/hello-world-workflow-tmpl.yaml +++ b/test/e2e/smoke/hello-world-workflow-tmpl.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: workflow-template-hello-world- - labels: - argo-e2e: true spec: entrypoint: whalesay templates: diff --git a/test/e2e/smoke/runasnonroot-workflow.yaml b/test/e2e/smoke/runasnonroot-workflow.yaml index 7bac579ad3f8..481d9232ecec 100644 --- a/test/e2e/smoke/runasnonroot-workflow.yaml +++ b/test/e2e/smoke/runasnonroot-workflow.yaml @@ -3,7 +3,7 @@ kind: Workflow metadata: generateName: runasnonroot- labels: - argo-e2e: true + spec: entrypoint: main securityContext: diff --git a/test/e2e/smoke/workflow-template-whalesay-template.yaml b/test/e2e/smoke/workflow-template-whalesay-template.yaml index fb810ae81541..ec30747725c6 100644 --- a/test/e2e/smoke/workflow-template-whalesay-template.yaml +++ b/test/e2e/smoke/workflow-template-whalesay-template.yaml @@ -3,7 +3,7 @@ kind: WorkflowTemplate metadata: name: workflow-template-whalesay-template labels: - argo-e2e: true + workflows.argoproj.io/test: "true" spec: entrypoint: whalesay-template onExit: on-exit diff --git a/test/e2e/testdata/archive-strategies.yaml b/test/e2e/testdata/archive-strategies.yaml index 2116a0fe17f4..ddc86041f5a9 100644 --- a/test/e2e/testdata/archive-strategies.yaml +++ b/test/e2e/testdata/archive-strategies.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: archive-strategies- - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/artifact-repository-ref.yaml b/test/e2e/testdata/artifact-repository-ref.yaml index 29ae21188698..616af152a75f 100644 --- a/test/e2e/testdata/artifact-repository-ref.yaml +++ b/test/e2e/testdata/artifact-repository-ref.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: artifact-repository-ref - labels: - argo-e2e: "true" spec: entrypoint: main artifactRepositoryRef: diff --git a/test/e2e/testdata/basic-clusterworkflowtemplate.yaml b/test/e2e/testdata/basic-clusterworkflowtemplate.yaml index e07d67038a03..7815f2bff63f 100644 --- a/test/e2e/testdata/basic-clusterworkflowtemplate.yaml +++ b/test/e2e/testdata/basic-clusterworkflowtemplate.yaml @@ -2,12 +2,10 @@ apiVersion: argoproj.io/v1alpha1 kind: ClusterWorkflowTemplate metadata: name: basic - labels: - argo-e2e: true spec: workflowMetadata: labels: - argo-e2e: true + workflows.argoproj.io/test: true entrypoint: main templates: - name: main diff --git a/test/e2e/testdata/basic-cronworkflow.yaml b/test/e2e/testdata/basic-cronworkflow.yaml index cbfcf69f65a1..1494197c44fd 100644 --- a/test/e2e/testdata/basic-cronworkflow.yaml +++ b/test/e2e/testdata/basic-cronworkflow.yaml @@ -2,13 +2,11 @@ apiVersion: argoproj.io/v1alpha1 kind: CronWorkflow metadata: name: basic - labels: - argo-e2e: true spec: + schedule: "* * * * *" workflowMetadata: labels: - argo-e2e: true - schedule: "* * * * *" + workflows.argoproj.io/test: "true" workflowSpec: entrypoint: main templates: diff --git a/test/e2e/testdata/basic-workflow.yaml b/test/e2e/testdata/basic-workflow.yaml index 59aa80fd892d..5b4f9f027fc4 100644 --- a/test/e2e/testdata/basic-workflow.yaml +++ b/test/e2e/testdata/basic-workflow.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: basic - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/basic-workflowtemplate.yaml b/test/e2e/testdata/basic-workflowtemplate.yaml index f1eefa9df531..28fe89f66aa3 100644 --- a/test/e2e/testdata/basic-workflowtemplate.yaml +++ b/test/e2e/testdata/basic-workflowtemplate.yaml @@ -2,12 +2,10 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: basic - labels: - argo-e2e: true spec: workflowMetadata: labels: - argo-e2e: true + workflows.argoproj.io/test: true entrypoint: main templates: - name: main diff --git a/test/e2e/testdata/cluster-workflow-template-nested-template.yaml b/test/e2e/testdata/cluster-workflow-template-nested-template.yaml index bfca45ff140b..937ad6e0e132 100644 --- a/test/e2e/testdata/cluster-workflow-template-nested-template.yaml +++ b/test/e2e/testdata/cluster-workflow-template-nested-template.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: ClusterWorkflowTemplate metadata: name: cluster-workflow-template-nested-template - labels: - argo-e2e: true spec: templates: - name: whalesay-inner-template diff --git a/test/e2e/testdata/cluster-workflow-template-ref.yaml b/test/e2e/testdata/cluster-workflow-template-ref.yaml index 4187c5da11d6..650c9b4b7991 100644 --- a/test/e2e/testdata/cluster-workflow-template-ref.yaml +++ b/test/e2e/testdata/cluster-workflow-template-ref.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: workflow-template-hello-world- - labels: - argo-e2e: "true" spec: entrypoint: whalesay-template arguments: diff --git a/test/e2e/testdata/exit-1.yaml b/test/e2e/testdata/exit-1.yaml index 6dd502041059..0a0ba09bb0ed 100644 --- a/test/e2e/testdata/exit-1.yaml +++ b/test/e2e/testdata/exit-1.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: exit-1 - labels: - argo-e2e: true spec: entrypoint: exit templates: diff --git a/test/e2e/testdata/input-artifacts.yaml b/test/e2e/testdata/input-artifacts.yaml index c97e5db037e2..2aaaa4147130 100644 --- a/test/e2e/testdata/input-artifacts.yaml +++ b/test/e2e/testdata/input-artifacts.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: input-artifacts - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/input-on-mount-workflow.yaml b/test/e2e/testdata/input-on-mount-workflow.yaml index 2292bfe0e95b..960912a46306 100644 --- a/test/e2e/testdata/input-on-mount-workflow.yaml +++ b/test/e2e/testdata/input-on-mount-workflow.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: input-on-mount- - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/log-problems.yaml b/test/e2e/testdata/log-problems.yaml index 13d23dbdfc0d..bd58e2d01975 100644 --- a/test/e2e/testdata/log-problems.yaml +++ b/test/e2e/testdata/log-problems.yaml @@ -3,8 +3,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: log-problems- - labels: - argo-e2e: true spec: entrypoint: plan templates: diff --git a/test/e2e/testdata/malformed/malformed-clusterworkflowtemplate.yaml b/test/e2e/testdata/malformed/malformed-clusterworkflowtemplate.yaml index 6108cbdb70f0..59cd8f51db36 100644 --- a/test/e2e/testdata/malformed/malformed-clusterworkflowtemplate.yaml +++ b/test/e2e/testdata/malformed/malformed-clusterworkflowtemplate.yaml @@ -3,7 +3,7 @@ kind: ClusterWorkflowTemplate metadata: name: malformed labels: - argo-e2e: malformed + workflows.argoproj.io/test: malformed spec: arguments: parameters: diff --git a/test/e2e/testdata/malformed/malformed-cronworkflow.yaml b/test/e2e/testdata/malformed/malformed-cronworkflow.yaml index 97d810938bd1..995785441225 100644 --- a/test/e2e/testdata/malformed/malformed-cronworkflow.yaml +++ b/test/e2e/testdata/malformed/malformed-cronworkflow.yaml @@ -3,7 +3,7 @@ kind: CronWorkflow metadata: name: malformed labels: - argo-e2e: malformed + workflows.argoproj.io/test: malformed spec: workflowSpec: arguments: diff --git a/test/e2e/testdata/malformed/malformed-workflow.yaml b/test/e2e/testdata/malformed/malformed-workflow.yaml index 92ccc98c7862..725effd111bb 100644 --- a/test/e2e/testdata/malformed/malformed-workflow.yaml +++ b/test/e2e/testdata/malformed/malformed-workflow.yaml @@ -3,7 +3,7 @@ kind: Workflow metadata: name: malformed labels: - argo-e2e: malformed + workflows.argoproj.io/test: malformed spec: arguments: parameters: diff --git a/test/e2e/testdata/malformed/malformed-workflowtemplate.yaml b/test/e2e/testdata/malformed/malformed-workflowtemplate.yaml index 72e42470f199..56e90f21e016 100644 --- a/test/e2e/testdata/malformed/malformed-workflowtemplate.yaml +++ b/test/e2e/testdata/malformed/malformed-workflowtemplate.yaml @@ -3,7 +3,7 @@ kind: WorkflowTemplate metadata: name: malformed labels: - argo-e2e: malformed + workflows.argoproj.io/test: malformed spec: arguments: parameters: diff --git a/test/e2e/testdata/node-suspend.yaml b/test/e2e/testdata/node-suspend.yaml index ba5d1446e5bc..a4038db063f7 100644 --- a/test/e2e/testdata/node-suspend.yaml +++ b/test/e2e/testdata/node-suspend.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: node-suspend - labels: - argo-e2e: true spec: entrypoint: node-suspend templates: diff --git a/test/e2e/testdata/output-artifact-with-s3-bucket-creation-enabled.yaml b/test/e2e/testdata/output-artifact-with-s3-bucket-creation-enabled.yaml index 1d086b01417a..a56526409964 100644 --- a/test/e2e/testdata/output-artifact-with-s3-bucket-creation-enabled.yaml +++ b/test/e2e/testdata/output-artifact-with-s3-bucket-creation-enabled.yaml @@ -3,8 +3,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: output-artifact-with-s3-bucket-creation-enabled- - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/output-on-input-workflow.yaml b/test/e2e/testdata/output-on-input-workflow.yaml index 10f39b0088cb..88c3244879ec 100644 --- a/test/e2e/testdata/output-on-input-workflow.yaml +++ b/test/e2e/testdata/output-on-input-workflow.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: input-on-mount- - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/output-on-mount-workflow.yaml b/test/e2e/testdata/output-on-mount-workflow.yaml index 1993c15fee94..93d914abf07c 100644 --- a/test/e2e/testdata/output-on-mount-workflow.yaml +++ b/test/e2e/testdata/output-on-mount-workflow.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: input-on-mount- - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/pending-workflow.yaml b/test/e2e/testdata/pending-workflow.yaml index 81837a39a38d..4e3acef61372 100644 --- a/test/e2e/testdata/pending-workflow.yaml +++ b/test/e2e/testdata/pending-workflow.yaml @@ -2,8 +2,6 @@ kind: Workflow apiVersion: argoproj.io/v1alpha1 metadata: generateName: pending- - labels: - argo-e2e: "true" spec: entrypoint: main templates: diff --git a/test/e2e/testdata/retry-omit.yaml b/test/e2e/testdata/retry-omit.yaml index a0e66c6021df..0e74b798f0e6 100644 --- a/test/e2e/testdata/retry-omit.yaml +++ b/test/e2e/testdata/retry-omit.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: retry-omit- - labels: - argo-e2e: true spec: entrypoint: diamond templates: diff --git a/test/e2e/testdata/retry-test.yaml b/test/e2e/testdata/retry-test.yaml index 5d117447ecf4..45efc88a127f 100644 --- a/test/e2e/testdata/retry-test.yaml +++ b/test/e2e/testdata/retry-test.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: retry-test - labels: - argo-e2e: "true" spec: entrypoint: steps-outer templates: diff --git a/test/e2e/testdata/same-input-output-path-optional.yaml b/test/e2e/testdata/same-input-output-path-optional.yaml index 47fdb5b24cfb..74f36590cf45 100644 --- a/test/e2e/testdata/same-input-output-path-optional.yaml +++ b/test/e2e/testdata/same-input-output-path-optional.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: optional-input-output-artifact-same-location- - labels: - argo-e2e: true spec: entrypoint: plan templates: diff --git a/test/e2e/testdata/semaphore-tmpl-level.yaml b/test/e2e/testdata/semaphore-tmpl-level.yaml index 07b3789dd6d4..08a32d5b3407 100644 --- a/test/e2e/testdata/semaphore-tmpl-level.yaml +++ b/test/e2e/testdata/semaphore-tmpl-level.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: semaphore-tmpl-level - labels: - argo-e2e: true spec: entrypoint: semaphore-tmpl-level-example templates: diff --git a/test/e2e/testdata/semaphore-wf-level-1.yaml b/test/e2e/testdata/semaphore-wf-level-1.yaml index f603e4686bea..16bb45c5069a 100644 --- a/test/e2e/testdata/semaphore-wf-level-1.yaml +++ b/test/e2e/testdata/semaphore-wf-level-1.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: semaphore-wf-level-1 - labels: - argo-e2e: true spec: entrypoint: whalesay synchronization: diff --git a/test/e2e/testdata/semaphore-wf-level.yaml b/test/e2e/testdata/semaphore-wf-level.yaml index 62cfc89a39b3..351cfa7f8bbf 100644 --- a/test/e2e/testdata/semaphore-wf-level.yaml +++ b/test/e2e/testdata/semaphore-wf-level.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: semaphore-wf-level - labels: - argo-e2e: true spec: entrypoint: whalesay synchronization: diff --git a/test/e2e/testdata/sidecar-workflow.yaml b/test/e2e/testdata/sidecar-workflow.yaml index a0fad6f44f33..dbe33ddfd0d8 100644 --- a/test/e2e/testdata/sidecar-workflow.yaml +++ b/test/e2e/testdata/sidecar-workflow.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: sidecar- - labels: - argo-e2e: "true" spec: entrypoint: main templates: diff --git a/test/e2e/testdata/sleep-3s.yaml b/test/e2e/testdata/sleep-3s.yaml index bc13a89c32f8..942e5c5289df 100644 --- a/test/e2e/testdata/sleep-3s.yaml +++ b/test/e2e/testdata/sleep-3s.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: sleep-3s - labels: - argo-e2e: true spec: entrypoint: sleep-3s templates: diff --git a/test/e2e/testdata/sleepy-retry-on-error-workflow.yaml b/test/e2e/testdata/sleepy-retry-on-error-workflow.yaml index 892ddd4a54c0..1a6b9d0842f3 100644 --- a/test/e2e/testdata/sleepy-retry-on-error-workflow.yaml +++ b/test/e2e/testdata/sleepy-retry-on-error-workflow.yaml @@ -2,8 +2,6 @@ kind: Workflow apiVersion: argoproj.io/v1alpha1 metadata: generateName: sleepy-retry-on-error- - labels: - argo-e2e: "true" spec: retryStrategy: retryPolicy: OnError diff --git a/test/e2e/testdata/sleepy-workflow.yaml b/test/e2e/testdata/sleepy-workflow.yaml index 00faa1f6229e..03c6660a9ffc 100644 --- a/test/e2e/testdata/sleepy-workflow.yaml +++ b/test/e2e/testdata/sleepy-workflow.yaml @@ -2,8 +2,6 @@ kind: Workflow apiVersion: argoproj.io/v1alpha1 metadata: generateName: sleepy- - labels: - argo-e2e: "true" spec: entrypoint: main templates: diff --git a/test/e2e/testdata/storage-limit.yaml b/test/e2e/testdata/storage-limit.yaml index 51b1e79644ad..033215e937e8 100644 --- a/test/e2e/testdata/storage-limit.yaml +++ b/test/e2e/testdata/storage-limit.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: storage-quota-limit - labels: - argo-e2e: true spec: entrypoint: wait volumeClaimTemplates: # define volume, same syntax as k8s Pod spec diff --git a/test/e2e/testdata/two-items.yaml b/test/e2e/testdata/two-items.yaml index 28295e672d31..6b13c9db485b 100644 --- a/test/e2e/testdata/two-items.yaml +++ b/test/e2e/testdata/two-items.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: name: two-items - labels: - argo-e2e: true spec: entrypoint: main templates: diff --git a/test/e2e/testdata/wellformed/wellformed-clusterworkflowtemplate.yaml b/test/e2e/testdata/wellformed/wellformed-clusterworkflowtemplate.yaml index 37462535c3d8..c40c4f6bd267 100644 --- a/test/e2e/testdata/wellformed/wellformed-clusterworkflowtemplate.yaml +++ b/test/e2e/testdata/wellformed/wellformed-clusterworkflowtemplate.yaml @@ -3,7 +3,7 @@ kind: ClusterWorkflowTemplate metadata: name: wellformed labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" spec: entrypoint: main templates: diff --git a/test/e2e/testdata/wellformed/wellformed-cronworkflow.yaml b/test/e2e/testdata/wellformed/wellformed-cronworkflow.yaml index 68643db42768..0b705ebecc34 100644 --- a/test/e2e/testdata/wellformed/wellformed-cronworkflow.yaml +++ b/test/e2e/testdata/wellformed/wellformed-cronworkflow.yaml @@ -3,12 +3,12 @@ kind: CronWorkflow metadata: name: wellformed labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" spec: schedule: "* * * * *" workflowMetadata: labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" workflowSpec: entrypoint: main templates: diff --git a/test/e2e/testdata/wellformed/wellformed-workflow-with-cluster-workflow-template-ref.yaml b/test/e2e/testdata/wellformed/wellformed-workflow-with-cluster-workflow-template-ref.yaml index c838df3dc9ca..d69f383237a0 100644 --- a/test/e2e/testdata/wellformed/wellformed-workflow-with-cluster-workflow-template-ref.yaml +++ b/test/e2e/testdata/wellformed/wellformed-workflow-with-cluster-workflow-template-ref.yaml @@ -3,7 +3,7 @@ kind: Workflow metadata: name: wellformed labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" spec: workflowTemplateRef: name: wellformed diff --git a/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-cluster-workflow-template-ref.yaml b/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-cluster-workflow-template-ref.yaml index 380ce231a4ec..88f86fc756e2 100644 --- a/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-cluster-workflow-template-ref.yaml +++ b/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-cluster-workflow-template-ref.yaml @@ -3,7 +3,7 @@ kind: Workflow metadata: name: wellformed labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" spec: workflowTemplateRef: name: malformed diff --git a/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-workflow-template-ref.yaml b/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-workflow-template-ref.yaml index bdb8715aa899..5082fa684ee2 100644 --- a/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-workflow-template-ref.yaml +++ b/test/e2e/testdata/wellformed/wellformed-workflow-with-malformed-workflow-template-ref.yaml @@ -3,7 +3,7 @@ kind: Workflow metadata: name: wellformed labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" spec: workflowTemplateRef: name: malformed \ No newline at end of file diff --git a/test/e2e/testdata/wellformed/wellformed-workflow-with-workflow-template-ref.yaml b/test/e2e/testdata/wellformed/wellformed-workflow-with-workflow-template-ref.yaml index f3de2926d910..501b1e1db379 100644 --- a/test/e2e/testdata/wellformed/wellformed-workflow-with-workflow-template-ref.yaml +++ b/test/e2e/testdata/wellformed/wellformed-workflow-with-workflow-template-ref.yaml @@ -3,7 +3,7 @@ kind: Workflow metadata: name: wellformed labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" spec: workflowTemplateRef: name: wellformed \ No newline at end of file diff --git a/test/e2e/testdata/wellformed/wellformed-workflowtemplate.yaml b/test/e2e/testdata/wellformed/wellformed-workflowtemplate.yaml index f198d4226ae9..b5cbf5f9c67f 100644 --- a/test/e2e/testdata/wellformed/wellformed-workflowtemplate.yaml +++ b/test/e2e/testdata/wellformed/wellformed-workflowtemplate.yaml @@ -3,7 +3,7 @@ kind: WorkflowTemplate metadata: name: wellformed labels: - argo-e2e: "true" + workflows.argoproj.io/test: "true" spec: entrypoint: main templates: diff --git a/test/e2e/testdata/wf-default-ns.yaml b/test/e2e/testdata/wf-default-ns.yaml index 523b29d238ea..72345cb3ead1 100644 --- a/test/e2e/testdata/wf-default-ns.yaml +++ b/test/e2e/testdata/wf-default-ns.yaml @@ -4,7 +4,7 @@ metadata: name: test-cron-wf-basic namespace: default labels: - argo-e2e: true + workflows.argoproj.io/test: "true" spec: schedule: "* * * * *" concurrencyPolicy: "Allow" @@ -13,7 +13,7 @@ spec: failedJobsHistoryLimit: 2 workflowMetadata: labels: - argo-e2e: true + workflows.argoproj.io/test: "true" workflowSpec: entrypoint: whalesay templates: @@ -21,5 +21,5 @@ spec: container: image: python:alpine3.6 imagePullPolicy: IfNotPresent - command: ["sh", -c] - args: ["echo hello"] \ No newline at end of file + command: [ "sh", -c ] + args: [ "echo hello" ] \ No newline at end of file diff --git a/test/e2e/testdata/workflow-template-nested-template.yaml b/test/e2e/testdata/workflow-template-nested-template.yaml index 352e97115f3e..edcf5a966ced 100644 --- a/test/e2e/testdata/workflow-template-nested-template.yaml +++ b/test/e2e/testdata/workflow-template-nested-template.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: workflow-template-nested-template - labels: - argo-e2e: true spec: templates: - name: whalesay-inner-template diff --git a/test/e2e/testdata/workflow-template-ref-exithandler.yaml b/test/e2e/testdata/workflow-template-ref-exithandler.yaml index 4f717bc83fce..bba7bc8e5e03 100644 --- a/test/e2e/testdata/workflow-template-ref-exithandler.yaml +++ b/test/e2e/testdata/workflow-template-ref-exithandler.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: workflow-template-hello-world- - labels: - argo-e2e: "true" spec: entrypoint: whalesay-template arguments: diff --git a/test/e2e/testdata/workflow-template-ref.yaml b/test/e2e/testdata/workflow-template-ref.yaml index 4f717bc83fce..bba7bc8e5e03 100644 --- a/test/e2e/testdata/workflow-template-ref.yaml +++ b/test/e2e/testdata/workflow-template-ref.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: generateName: workflow-template-hello-world- - labels: - argo-e2e: "true" spec: entrypoint: whalesay-template arguments: diff --git a/test/e2e/testdata/workflow-template-with-enum-values.yaml b/test/e2e/testdata/workflow-template-with-enum-values.yaml index 224953629f84..7b1a047fc76a 100644 --- a/test/e2e/testdata/workflow-template-with-enum-values.yaml +++ b/test/e2e/testdata/workflow-template-with-enum-values.yaml @@ -2,8 +2,6 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: workflow-template-with-enum-values - labels: - argo-e2e: true spec: entrypoint: argosay arguments: diff --git a/test/e2e/testdata/workflow-templates/invalid-workflowtemplate.yaml b/test/e2e/testdata/workflow-templates/invalid-workflowtemplate.yaml index 757f07c5802c..addf05e6c835 100644 --- a/test/e2e/testdata/workflow-templates/invalid-workflowtemplate.yaml +++ b/test/e2e/testdata/workflow-templates/invalid-workflowtemplate.yaml @@ -2,12 +2,10 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: basic - labels: - argo-e2e: true spec: workflowMetadata: labels: - argo-e2e: true + workflows.argoproj.io/test: true entrypoints: main templates: - name: main diff --git a/test/e2e/testdata/workflow-templates/workflowtemplate.yaml b/test/e2e/testdata/workflow-templates/workflowtemplate.yaml index f1eefa9df531..ede10a5d3311 100644 --- a/test/e2e/testdata/workflow-templates/workflowtemplate.yaml +++ b/test/e2e/testdata/workflow-templates/workflowtemplate.yaml @@ -2,12 +2,10 @@ apiVersion: argoproj.io/v1alpha1 kind: WorkflowTemplate metadata: name: basic - labels: - argo-e2e: true spec: workflowMetadata: labels: - argo-e2e: true + entrypoint: main templates: - name: main diff --git a/test/e2e/workflow_template_test.go b/test/e2e/workflow_template_test.go index 29ebb8abff2c..b8ac179f3ab6 100644 --- a/test/e2e/workflow_template_test.go +++ b/test/e2e/workflow_template_test.go @@ -23,7 +23,7 @@ func (s *WorkflowTemplateSuite) TestSubmitWorkflowTemplate() { WorkflowName("my-wf"). When(). CreateWorkflowTemplates(). - RunCli([]string{"submit", "--from", "workflowtemplate/workflow-template-whalesay-template", "--name", "my-wf", "-l", "argo-e2e=true"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "--from", "workflowtemplate/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(). @@ -45,8 +45,6 @@ func (s *WorkflowTemplateSuite) TestNestedWorkflowTemplate() { kind: Workflow metadata: generateName: workflow-template-nested- - labels: - argo-e2e: true spec: entrypoint: whalesay templates: @@ -75,7 +73,7 @@ func (s *WorkflowTemplateSuite) TestSubmitWorkflowTemplateWithEnum() { WorkflowName("my-wf-with-enum"). When(). CreateWorkflowTemplates(). - RunCli([]string{"submit", "--from", "workflowtemplate/workflow-template-with-enum-values", "--name", "my-wf-with-enum", "-l", "argo-e2e=true"}, func(t *testing.T, output string, err error) { + RunCli([]string{"submit", "--from", "workflowtemplate/workflow-template-with-enum-values", "--name", "my-wf-with-enum", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) { assert.NoError(t, err) }). WaitForWorkflow().