Skip to content

Commit

Permalink
Enabled test reports for all test runners and save reports in one place
Browse files Browse the repository at this point in the history
  • Loading branch information
lwr20 committed Sep 12, 2018
1 parent c2b035b commit ec2b768
Show file tree
Hide file tree
Showing 33 changed files with 131 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ junit.xml
.generate_exes
.generate_files
checkouts
/report/*.xml
/release
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ut: vendor run-etcd run-kubernetes-master
-v $(CURDIR):/go/src/github.com/$(PACKAGE_NAME):rw \
-v $(CURDIR)/.go-pkg-cache:/go-cache/:rw \
-e GOCACHE=/go-cache \
$(CALICO_BUILD) sh -c 'cd /go/src/github.com/$(PACKAGE_NAME) && ginkgo -r --skipPackage vendor .'
$(CALICO_BUILD) sh -c 'cd /go/src/github.com/$(PACKAGE_NAME) && ginkgo -r --skipPackage vendor $(GINKGO_ARGS) .'

## Run etcd as a container (calico-etcd)
run-etcd: stop-etcd
Expand Down
7 changes: 5 additions & 2 deletions lib/apis/v3/v3_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestV2(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "v3 API Suite")
junitReporter := reporters.NewJUnitReporter("../../../report/v3_api_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "v3 API Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/backend/backend_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestEtcd(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Datastore backend Suite")
junitReporter := reporters.NewJUnitReporter("../../report/datastore_backend_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Datastore backend Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/backend/etcd/etcd_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestEtcd(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Etcd Suite")
junitReporter := reporters.NewJUnitReporter("../../../report/etcd_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Etcd Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/backend/etcdv3/etcdv3_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestEtcd(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "EtcdV3 Suite")
junitReporter := reporters.NewJUnitReporter("../../../report/etcdv3_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "EtcdV3 Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/backend/k8s/conversion/conversion_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestConversion(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Conversion Suite")
junitReporter := reporters.NewJUnitReporter("../../../../report/conversion_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Conversion Suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/backend/k8s/k8s_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Tigera, Inc. All rights reserved.
// Copyright (c) 2016,2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (

"testing"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestModel(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "Model Suite")
junitReporter := reporters.NewJUnitReporter("../../../report/model_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Model Suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/backend/k8s/resources/resources_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Tigera, Inc. All rights reserved.
// Copyright (c) 2016,2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (

"testing"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestModel(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "K8s resources Suite")
junitReporter := reporters.NewJUnitReporter("../../../../report/k8s_resources_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "K8s resources Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/backend/model/model_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Tigera, Inc. All rights reserved.
// Copyright (c) 2016,2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestModel(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Model Suite")
junitReporter := reporters.NewJUnitReporter("../../../report/model_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Model Suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/backend/syncersv1/bgpsyncer/bgpsyncer_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestClient(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "BGP syncer test suite")
junitReporter := reporters.NewJUnitReporter("../../../../report/bgpsyncer_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "BGP syncer test suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/backend/syncersv1/felixsyncer/felixsyncerv1_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestClient(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "Felix syncer test suite")
junitReporter := reporters.NewJUnitReporter("../../../../report/felix_syncer_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Felix syncer test Suite", []Reporter{junitReporter})
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestClient(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "Syncer update processors suite")
junitReporter := reporters.NewJUnitReporter("../../../../report/syncer_update_proc_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Syncer update processors suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/backend/watchersyncer/watchersyncer_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestClient(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "Backend multi-watcher/syncer test suite")
junitReporter := reporters.NewJUnitReporter("../../../report/backend_watcher_syncer_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Backend multi-watcher/syncer test suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/clientv3/client_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestClient(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "client Suite")
junitReporter := reporters.NewJUnitReporter("../../report/client_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "client Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/converter/converter_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestConverter(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Converter Suite")
junitReporter := reporters.NewJUnitReporter("../../report/converter_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Converter Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/errors/errors_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Tigera, Inc. All rights reserved.
// Copyright (c) 2016,2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestModel(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Errors Suite")
junitReporter := reporters.NewJUnitReporter("../../report/errors_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Errors Suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/health/health_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (

"testing"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestSet(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "Health Suite")
junitReporter := reporters.NewJUnitReporter("../../report/health_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Health Suite", []Reporter{junitReporter})
}
7 changes: 5 additions & 2 deletions lib/hwm/hwm_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Tigera, Inc. All rights reserved.
// Copyright (c) 2016,2018 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,9 +19,12 @@ import (
. "github.com/onsi/gomega"

"testing"

"github.com/onsi/ginkgo/reporters"
)

func TestHwm(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "HWM Tracker Suite")
junitReporter := reporters.NewJUnitReporter("../../report/hwm_tracker_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "HWM Tracker Suite", []Reporter{junitReporter})
}
6 changes: 4 additions & 2 deletions lib/ipam/ipam_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/onsi/ginkgo/reporters"
"github.com/projectcalico/libcalico-go/lib/testutils"
)

func TestIpam(t *testing.T) {
testutils.HookLogrusForGinkgo()
RegisterFailHandler(Fail)
RunSpecs(t, "IPAM Suite")
junitReporter := reporters.NewJUnitReporter("../../report/ipam_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "IPAM Suite", []Reporter{junitReporter})
}
2 changes: 1 addition & 1 deletion lib/jitter/jitter_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ func init() {

func TestJitter(t *testing.T) {
RegisterFailHandler(Fail)
junitReporter := reporters.NewJUnitReporter("junit.xml")
junitReporter := reporters.NewJUnitReporter("../../report/jitter_suite.xml")
RunSpecsWithDefaultAndCustomReporters(t, "Jitter Suite", []Reporter{junitReporter})
}
Loading

0 comments on commit ec2b768

Please sign in to comment.