Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 10f249a

Browse files
authored
Merge pull request #113 from jetstack/test-junit
Add junit test reports
2 parents 9ff574e + 1d8fb8d commit 10f249a

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/kube-oidc-proxy
22
/bin
33
/demo/config.jsonnet
4+
/artifacts/

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Copyright Jetstack Ltd. See LICENSE for details.
2-
BINDIR ?= $(CURDIR)/bin
3-
HACK_DIR ?= hack
4-
PATH := $(BINDIR):$(PATH)
2+
BINDIR ?= $(CURDIR)/bin
3+
HACK_DIR ?= hack
4+
PATH := $(BINDIR):$(PATH)
5+
ARTIFACTS ?= artifacts
56

67
export GO111MODULE=on
78

@@ -83,9 +84,12 @@ generate: depend ## generates mocks and assets files
8384
go generate $$(go list ./pkg/... ./cmd/...)
8485

8586
test: generate verify ## run all go tests
86-
go test $$(go list ./pkg/... ./cmd/... | grep -v pkg/e2e)
87+
mkdir -p $(ARTIFACTS)
88+
go test -v -bench $$(go list ./pkg/... ./cmd/... | grep -v pkg/e2e) | tee $(ARTIFACTS)/go-test.stdout
89+
cat $(ARTIFACTS)/go-test.stdout | go run github.com/jstemmer/go-junit-report > $(ARTIFACTS)/junit-go-test.xml
8790

8891
e2e: ## run end to end tests
92+
mkdir -p $(ARTIFACTS)
8993
KUBE_OIDC_PROXY_ROOT_PATH="$$(pwd)" go test -timeout 30m -v --count=1 ./test/e2e/suite/.
9094

9195
build: generate ## build kube-oidc-proxy

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.13
55
require (
66
github.com/golang/mock v1.2.0
77
github.com/heptiolabs/healthcheck v0.0.0-20180807145615-6ff867650f40
8+
github.com/jstemmer/go-junit-report v0.9.1 // indirect
89
github.com/onsi/ginkgo v1.10.1
910
github.com/onsi/gomega v1.7.0
1011
github.com/sirupsen/logrus v1.4.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
150150
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
151151
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
152152
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
153+
github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
154+
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
153155
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
154156
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
155157
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=

test/e2e/suite/suite_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
package suite
33

44
import (
5-
//"fmt"
6-
//"path"
5+
"os"
6+
"path/filepath"
77
"testing"
88
"time"
99

1010
"github.com/onsi/ginkgo"
1111
ginkgoconfig "github.com/onsi/ginkgo/config"
12-
13-
//"github.com/onsi/ginkgo/reporters"
12+
"github.com/onsi/ginkgo/reporters"
1413
"github.com/onsi/gomega"
1514
"k8s.io/apimachinery/pkg/util/wait"
1615

@@ -31,13 +30,14 @@ func init() {
3130
func TestE2E(t *testing.T) {
3231
gomega.RegisterFailHandler(ginkgo.Fail)
3332

34-
var r []ginkgo.Reporter
35-
//if framework.DefaultConfig.Ginkgo.ReportDirectory != "" {
36-
// r = append(r, reporters.NewJUnitReporter(path.Join(framework.DefaultConfig.Ginkgo.ReportDirectory,
37-
// fmt.Sprintf("junit_%s_%02d.xml",
38-
// framework.DefaultConfig.Ginkgo.ReportPrefix,
39-
// ginkgoconfig.GinkgoConfig.ParallelNode))))
40-
//}
33+
junitPath := "../../../artifacts"
34+
if path := os.Getenv("ARTIFACTS"); path != "" {
35+
junitPath = path
36+
}
4137

42-
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "kube-oidc-proxy e2e suite", r)
38+
junitReporter := reporters.NewJUnitReporter(filepath.Join(
39+
junitPath,
40+
"junit-go-e2e.xml",
41+
))
42+
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "kube-oidc-proxy e2e suite", []ginkgo.Reporter{junitReporter})
4343
}

0 commit comments

Comments
 (0)