From ba3ef043afada0bb42a95b2a713e919abcd419ef Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Mon, 28 Oct 2019 11:28:27 -0400 Subject: [PATCH] [e2e] add junit output for e2e tests --- .gitignore | 3 +++ test/e2e/e2e_suite_test.go | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8bc8377103..4e12270004 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,7 @@ config/samples manager_image_patch.yaml-e manager_pull_policy.yaml-e +# junit files +junit.*.xml + .DS_Store diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index d5e66e02a8..7eb37c5f01 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -32,6 +32,8 @@ import ( "text/template" . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/config" + "github.com/onsi/ginkgo/reporters" . "github.com/onsi/gomega" "github.com/aws/aws-sdk-go/aws" @@ -61,7 +63,15 @@ import ( func TestE2e(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "e2e Suite") + + // If running in prow, output the junit files to the artifacts path + junitPath := fmt.Sprintf("junit.e2e_suite.%d.xml", config.GinkgoConfig.ParallelNode) + artifactPath, exists := os.LookupEnv("ARTIFACTS") + if exists { + junitPath = path.Join(artifactPath, junitPath) + } + junitReporter := reporters.NewJUnitReporter(junitPath) + RunSpecsWithDefaultAndCustomReporters(t, "e2e Suite", []Reporter{junitReporter}) } const (