Skip to content

Commit b371580

Browse files
committed
Adapt custom reporter to changed reporting infrastructure
This is only a temporary adaption, as we are using the temporary compatibility layer, which will be removed again soon. Hence, we have to rework this and adapt for the long-term.
1 parent 7bff39b commit b371580

37 files changed

+334
-91
lines changed

pkg/builder/builder_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2526
"k8s.io/apimachinery/pkg/api/meta"
@@ -36,10 +37,11 @@ import (
3637
"sigs.k8s.io/controller-runtime/pkg/webhook"
3738
)
3839

40+
var suiteName = "application Suite"
41+
3942
func TestBuilder(t *testing.T) {
4043
RegisterFailHandler(Fail)
41-
suiteName := "application Suite"
42-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
44+
RunSpecs(t, suiteName)
4345
}
4446

4547
var testenv *envtest.Environment
@@ -75,6 +77,11 @@ var _ = AfterSuite(func() {
7577
webhook.DefaultPort = 9443
7678
})
7779

80+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
81+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
82+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
83+
})
84+
7885
func addCRDToEnvironment(env *envtest.Environment, gvks ...schema.GroupVersionKind) {
7986
for _, gvk := range gvks {
8087
plural, singular := meta.UnsafeGuessKindToResource(gvk)

pkg/cache/cache_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425
"k8s.io/client-go/kubernetes"
2526
"k8s.io/client-go/rest"
@@ -29,10 +30,11 @@ import (
2930
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3031
)
3132

33+
var suiteName = "Cache Suite"
34+
3235
func TestSource(t *testing.T) {
3336
RegisterFailHandler(Fail)
34-
suiteName := "Cache Suite"
35-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
37+
RunSpecs(t, suiteName)
3638
}
3739

3840
var testenv *envtest.Environment
@@ -55,3 +57,8 @@ var _ = BeforeSuite(func() {
5557
var _ = AfterSuite(func() {
5658
Expect(testenv.Stop()).To(Succeed())
5759
})
60+
61+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
62+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
63+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
64+
})

pkg/certwatcher/certwatcher_suite_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,22 @@ import (
2121
"testing"
2222

2323
. "github.com/onsi/ginkgo/v2"
24+
"github.com/onsi/ginkgo/v2/reporters"
2425
. "github.com/onsi/gomega"
2526
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
2627
logf "sigs.k8s.io/controller-runtime/pkg/log"
2728
"sigs.k8s.io/controller-runtime/pkg/log/zap"
2829
)
2930

3031
var (
31-
certPath = "testdata/tls.crt"
32-
keyPath = "testdata/tls.key"
32+
certPath = "testdata/tls.crt"
33+
keyPath = "testdata/tls.key"
34+
suiteName = "CertWatcher Suite"
3335
)
3436

3537
func TestSource(t *testing.T) {
3638
RegisterFailHandler(Fail)
37-
suiteName := "CertWatcher Suite"
38-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
39+
RunSpecs(t, suiteName)
3940
}
4041

4142
var _ = BeforeSuite(func() {
@@ -47,3 +48,8 @@ var _ = AfterSuite(func() {
4748
_ = os.Remove(file)
4849
}
4950
})
51+
52+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
53+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
54+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
55+
})

pkg/client/apiutil/apiutil_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425
"k8s.io/client-go/rest"
2526
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
@@ -28,10 +29,11 @@ import (
2829
"sigs.k8s.io/controller-runtime/pkg/log/zap"
2930
)
3031

32+
var suiteName = "API Utilities Test Suite"
33+
3134
func TestSource(t *testing.T) {
3235
RegisterFailHandler(Fail)
33-
suiteName := "API Utilities Test Suite"
34-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
36+
RunSpecs(t, suiteName)
3537
}
3638

3739
var cfg *rest.Config
@@ -42,3 +44,8 @@ var _ = BeforeSuite(func() {
4244
// for things that technically need a rest.Config for defaulting, but don't actually use them
4345
cfg = &rest.Config{}
4446
})
47+
48+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
49+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
50+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
51+
})

pkg/client/client_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425
"k8s.io/client-go/kubernetes"
2526
"k8s.io/client-go/kubernetes/scheme"
@@ -32,10 +33,11 @@ import (
3233
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3334
)
3435

36+
var suiteName = "Client Suite"
37+
3538
func TestSource(t *testing.T) {
3639
RegisterFailHandler(Fail)
37-
suiteName := "Client Suite"
38-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
40+
RunSpecs(t, suiteName)
3941
}
4042

4143
var testenv *envtest.Environment
@@ -60,3 +62,8 @@ var _ = BeforeSuite(func() {
6062
var _ = AfterSuite(func() {
6163
Expect(testenv.Stop()).To(Succeed())
6264
})
65+
66+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
67+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
68+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
69+
})

pkg/client/config/config_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425

2526
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
2627
logf "sigs.k8s.io/controller-runtime/pkg/log"
2728
"sigs.k8s.io/controller-runtime/pkg/log/zap"
2829
)
2930

31+
var suiteName = "Client Config Test Suite"
32+
3033
func TestConfig(t *testing.T) {
3134
RegisterFailHandler(Fail)
32-
suiteName := "Client Config Test Suite"
33-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
35+
RunSpecs(t, suiteName)
3436
}
3537

3638
var _ = BeforeSuite(func() {
3739
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
3840
})
41+
42+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
43+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
44+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
45+
})

pkg/client/fake/client_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
2526

2627
logf "sigs.k8s.io/controller-runtime/pkg/log"
2728
"sigs.k8s.io/controller-runtime/pkg/log/zap"
2829
)
2930

31+
var suiteName = "Fake client Suite"
32+
3033
func TestSource(t *testing.T) {
3134
RegisterFailHandler(Fail)
32-
suiteName := "Fake client Suite"
33-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
35+
RunSpecs(t, suiteName)
3436
}
3537

3638
var _ = BeforeSuite(func() {
3739
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
3840
})
41+
42+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
43+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
44+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
45+
})

pkg/cluster/cluster_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"testing"
2222

2323
. "github.com/onsi/ginkgo/v2"
24+
"github.com/onsi/ginkgo/v2/reporters"
2425
. "github.com/onsi/gomega"
2526
"k8s.io/client-go/kubernetes"
2627
"k8s.io/client-go/rest"
@@ -30,10 +31,11 @@ import (
3031
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3132
)
3233

34+
var suiteName = "Cluster Suite"
35+
3336
func TestSource(t *testing.T) {
3437
RegisterFailHandler(Fail)
35-
suiteName := "Cluster Suite"
36-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
38+
RunSpecs(t, suiteName)
3739
}
3840

3941
var testenv *envtest.Environment
@@ -68,3 +70,8 @@ var _ = BeforeSuite(func() {
6870
var _ = AfterSuite(func() {
6971
Expect(testenv.Stop()).To(Succeed())
7072
})
73+
74+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
75+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
76+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
77+
})

pkg/config/config_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425

2526
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
2627
)
2728

29+
var suiteName = "Config Suite"
30+
2831
func TestScheme(t *testing.T) {
2932
RegisterFailHandler(Fail)
30-
suiteName := "Config Suite"
31-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
33+
RunSpecs(t, suiteName)
3234
}
35+
36+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
37+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
38+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
39+
})

pkg/controller/controller_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"testing"
2222

2323
. "github.com/onsi/ginkgo/v2"
24+
"github.com/onsi/ginkgo/v2/reporters"
2425
. "github.com/onsi/gomega"
2526
"k8s.io/apimachinery/pkg/runtime/schema"
2627
"k8s.io/client-go/kubernetes"
@@ -36,10 +37,11 @@ import (
3637
crscheme "sigs.k8s.io/controller-runtime/pkg/scheme"
3738
)
3839

40+
var suiteName = "Controller Integration Suite"
41+
3942
func TestSource(t *testing.T) {
4043
RegisterFailHandler(Fail)
41-
suiteName := "Controller Integration Suite"
42-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
44+
RunSpecs(t, suiteName)
4345
}
4446

4547
var testenv *envtest.Environment
@@ -90,3 +92,8 @@ var _ = AfterSuite(func() {
9092
// Put the DefaultBindAddress back
9193
metrics.DefaultBindAddress = ":8080"
9294
})
95+
96+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
97+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
98+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
99+
})

pkg/controller/controllerutil/controllerutil_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425

2526
"k8s.io/client-go/rest"
@@ -28,10 +29,11 @@ import (
2829
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
2930
)
3031

32+
var suiteName = "Controllerutil Suite"
33+
3134
func TestControllerutil(t *testing.T) {
3235
RegisterFailHandler(Fail)
33-
suiteName := "Controllerutil Suite"
34-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
36+
RunSpecs(t, suiteName)
3537
}
3638

3739
var testenv *envtest.Environment
@@ -53,3 +55,8 @@ var _ = BeforeSuite(func() {
5355
var _ = AfterSuite(func() {
5456
Expect(testenv.Stop()).To(Succeed())
5557
})
58+
59+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
60+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
61+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
62+
})

pkg/envtest/envtest_suite_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"testing"
2121

2222
. "github.com/onsi/ginkgo/v2"
23+
"github.com/onsi/ginkgo/v2/reporters"
2324
. "github.com/onsi/gomega"
2425
admissionv1 "k8s.io/api/admissionregistration/v1"
2526
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -29,10 +30,11 @@ import (
2930
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3031
)
3132

33+
var suiteName = "Envtest Suite"
34+
3235
func TestSource(t *testing.T) {
3336
RegisterFailHandler(Fail)
34-
suiteName := "Envtest Suite"
35-
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{NewlineReporter{}, printer.NewProwReporter(suiteName)})
37+
RunSpecs(t, suiteName)
3638
}
3739

3840
var env *Environment
@@ -134,3 +136,8 @@ func initializeWebhookInEnvironment() {
134136
var _ = AfterSuite(func() {
135137
Expect(env.Stop()).NotTo(HaveOccurred())
136138
})
139+
140+
var _ = ReportAfterSuite("Report to Prow", func(report Report) {
141+
reporters.ReportViaDeprecatedReporter(printer.NewlineReporter{}, report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
142+
reporters.ReportViaDeprecatedReporter(printer.NewProwReporter(suiteName), report) //nolint // For migration of custom reporter check https://onsi.github.io/ginkgo/MIGRATING_TO_V2#migration-strategy-2
143+
})

0 commit comments

Comments
 (0)