Skip to content

Commit 89d75a6

Browse files
authored
test: refactor E2E examples tests and fix Makefile (#14094)
Signed-off-by: Mason Malone <651224+MasonM@users.noreply.github.com>
1 parent b2a2c8f commit 89d75a6

42 files changed

Lines changed: 199 additions & 241 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-build.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
- sdks/**
6262
# example test suite
6363
- examples/**
64-
- hack/test-examples.sh
6564
codegen:
6665
- *common
6766
# generated files

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ endif
5151
# -- install & run options
5252
PROFILE ?= minimal
5353
KUBE_NAMESPACE ?= argo # namespace where Kubernetes resources/RBAC will be installed
54-
PLUGINS ?= $(shell [ $PROFILE = plugins ] && echo false || echo true)
54+
PLUGINS ?= $(shell [ $(PROFILE) = plugins ] && echo true || echo false)
5555
UI ?= false # start the UI with HTTP
5656
UI_SECURE ?= false # start the UI with HTTPS
5757
API ?= $(UI) # start the Argo Server
@@ -608,10 +608,6 @@ test-cli: ./dist/argo
608608
test-%:
609609
E2E_WAIT_TIMEOUT=$(E2E_WAIT_TIMEOUT) go test -failfast -v -timeout $(E2E_SUITE_TIMEOUT) -count 1 --tags $* -parallel $(E2E_PARALLEL) ./test/e2e
610610

611-
.PHONY: test-examples
612-
test-examples:
613-
./hack/test-examples.sh
614-
615611
.PHONY: test-%-sdk
616612
test-%-sdk:
617613
make --directory sdks/$* install test -B

examples/webhdfs-input-output-artifacts.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ spec:
4949
artifacts:
5050
- name: my-art2
5151
path: /my-artifact
52-
overwrite: true
5352
http:
5453
# below is an example on how to use authentication via certificates
5554
# clientCert.clientCertSecret: points to a kubernetes secret named cert-sec with a data entry of "certificate.pem"

hack/test-examples.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

test/e2e/cli_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,6 @@ func (s *CLISuite) TestCronCommands() {
13921392
assert.Contains(t, output, "5 5 5 * *")
13931393
assert.Contains(t, output, "Replace")
13941394
assert.Contains(t, output, "whalesay")
1395-
assert.NotContains(t, output, "argosay")
13961395
})
13971396
})
13981397
s.Run("Create Parameter Override", func() {

test/e2e/cron/basic-update-template.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ spec:
2626
parameters:
2727
- name: message
2828
container:
29-
image: python:alpine3.6
30-
command: [ "sh", -c ]
31-
args: [ "echo {{inputs.parameters.message}}" ]
29+
image: argoproj/argosay:v2
30+
args: [ "echo", "{{inputs.parameters.message}}" ]

test/e2e/cron/cron-and-malformed-template.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ spec:
1818
templates:
1919
- name: whalesay
2020
container:
21-
image: python:alpine3.6
22-
command: ["sh", -c]
23-
args: ["echo hello"]
21+
image: argoproj/argosay:v2
22+
args: ["echo", "hello"]
2423

2524
---
2625

test/e2e/cron/param.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@ spec:
2525
parameters:
2626
- name: message
2727
container:
28-
image: python:alpine3.6
29-
command: ["sh", -c]
30-
args: ["echo {{inputs.parameters.message}}"]
28+
image: argoproj/argosay:v2
29+
args: ["echo", "{{inputs.parameters.message}}"]

test/e2e/cron_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,7 @@ spec:
454454
}
455455

456456
func (s *CronSuite) TestMalformedCronWorkflow() {
457-
s.Given().
458-
Exec("kubectl", []string{"apply", "-f", "testdata/malformed/malformed-cronworkflow.yaml"}, fixtures.ErrorOutput("unknown field \"spec.workflowSpec.arguments.parameters.someParam\""))
457+
s.Given().KubectlApply("testdata/malformed/malformed-cronworkflow.yaml", fixtures.ErrorOutput(".spec.workflowSpec.arguments.parameters: expected list"))
459458
}
460459

461460
func TestCronSuite(t *testing.T) {

test/e2e/examples_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//go:build examples
2+
3+
package e2e
4+
5+
import (
6+
"testing"
7+
8+
"github.com/stretchr/testify/suite"
9+
10+
"github.com/argoproj/argo-workflows/v3/test/e2e/fixtures"
11+
fileutil "github.com/argoproj/argo-workflows/v3/util/file"
12+
"github.com/argoproj/argo-workflows/v3/workflow/common"
13+
)
14+
15+
type ExamplesSuite struct {
16+
fixtures.E2ESuite
17+
}
18+
19+
func (s *ExamplesSuite) BeforeTest(suiteName, testName string) {
20+
s.E2ESuite.BeforeTest(suiteName, testName)
21+
s.Given().KubectlApply("../../examples/configmaps/simple-parameters-configmap.yaml", fixtures.NoError)
22+
}
23+
24+
func (s *ExamplesSuite) TestExampleWorkflows() {
25+
err := fileutil.WalkManifests("../../examples", func(path string, data []byte) error {
26+
wfs, err := common.SplitWorkflowYAMLFile(data, true)
27+
if err != nil {
28+
s.T().Fatalf("Error parsing %s: %v", path, err)
29+
}
30+
for _, wf := range wfs {
31+
if _, ok := wf.GetLabels()["workflows.argoproj.io/test"]; ok {
32+
s.T().Logf("Found example workflow at %s with test label\n", path)
33+
s.Given().
34+
ExampleWorkflow(&wf).
35+
When().
36+
SubmitWorkflow().
37+
WaitForWorkflow(fixtures.ToBeSucceeded)
38+
}
39+
}
40+
return nil
41+
})
42+
s.CheckError(err)
43+
}
44+
45+
func TestExamplesSuite(t *testing.T) {
46+
suite.Run(t, new(ExamplesSuite))
47+
}

0 commit comments

Comments
 (0)