forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: refactor E2E examples tests and minor cleanup
This rewrites `hack/test-examples.sh` in Go to make those tests easier to debug and facilitate testing more complex scenarios, like the VAP added in argoproj#14045 The new tests do strict validation, which caught a bug in `examples/webhdfs-input-output-artifacts.yaml`: ``` $ kubectl apply -f examples/webhdfs-input-output-artifacts.yaml Error from server (BadRequest): error when creating "examples/webhdfs-input-output-artifacts.yaml": Workflow in version "v1alpha1" cannot be handled as a Workflow: strict decoding error: unknown field "spec.templates[0].outputs.artifacts[0].overwrite" ``` $ make test-examples <SNIP> examples_test.go:28: Error parsing ../../examples/webhdfs-input-output-artifacts.yaml: strict decoding error: unknown field "spec.templates[0].outputs.artifacts[0].overwrite" === FAIL: ExamplesSuite/TestExampleWorkflows FAIL github.com/argoproj/argo-workflows/v3/test/e2e 1.580s FAIL make: *** [Makefile:609: test-examples] Error 1 ``` Signed-off-by: Mason Malone <[email protected]>
- Loading branch information
Showing
8 changed files
with
78 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//go:build examples | ||
|
||
package e2e | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/suite" | ||
|
||
"github.com/argoproj/argo-workflows/v3/test/e2e/fixtures" | ||
fileutil "github.com/argoproj/argo-workflows/v3/util/file" | ||
"github.com/argoproj/argo-workflows/v3/workflow/common" | ||
) | ||
|
||
type ExamplesSuite struct { | ||
fixtures.E2ESuite | ||
} | ||
|
||
func (s *ExamplesSuite) BeforeTest(suiteName, testName string) { | ||
s.E2ESuite.BeforeTest(suiteName, testName) | ||
s.Given().KubectlApply("../../examples/configmaps/simple-parameters-configmap.yaml", fixtures.NoError) | ||
} | ||
|
||
func (s *ExamplesSuite) TestExampleWorkflows() { | ||
err := fileutil.WalkManifests("../../examples", func(path string, data []byte) error { | ||
wfs, err := common.SplitWorkflowYAMLFile(data, true) | ||
if err != nil { | ||
s.T().Fatalf("Error parsing %s: %v", path, err) | ||
} | ||
for _, wf := range wfs { | ||
if _, ok := wf.GetLabels()["workflows.argoproj.io/test"]; ok { | ||
s.T().Logf("Found example workflow at %s with test label\n", path) | ||
s.Given(). | ||
Workflow(&wf). | ||
When(). | ||
SubmitWorkflow(). | ||
WaitForWorkflow(fixtures.ToBeSucceeded) | ||
} | ||
} | ||
return nil | ||
}) | ||
s.CheckError(err) | ||
} | ||
|
||
func TestExamplesSuite(t *testing.T) { | ||
suite.Run(t, new(ExamplesSuite)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters