Skip to content

Commit 966f0e6

Browse files
authored
Merge pull request #1239 from Nordix/lentzi90/fix-ginkgo-warnings
🌱 Fix ginkgo warnings
2 parents 5759c47 + b99a82f commit 966f0e6

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

controllers/suite_test.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"sigs.k8s.io/cluster-api/test/framework"
3232
"sigs.k8s.io/controller-runtime/pkg/client"
3333
"sigs.k8s.io/controller-runtime/pkg/envtest"
34-
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
3534

3635
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha5"
3736
)
@@ -48,15 +47,16 @@ var (
4847
func TestAPIs(t *testing.T) {
4948
RegisterFailHandler(Fail)
5049

51-
RunSpecsWithDefaultAndCustomReporters(t,
52-
"Controller Suite",
53-
[]Reporter{printer.NewlineReporter{}})
50+
RunSpecs(t, "Controller Suite")
5451
}
5552

56-
var _ = BeforeSuite(func(done Done) {
53+
// See https://github.com/onsi/ginkgo/blob/ver2/docs/MIGRATING_TO_V2.md#removed-async-testing
54+
var _ = BeforeSuite(func() {
5755
By("bootstrapping test environment")
5856
testEnv = &envtest.Environment{
59-
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
57+
CRDDirectoryPaths: []string{
58+
filepath.Join("..", "config", "crd", "bases"),
59+
},
6060
}
6161

6262
var err error
@@ -67,17 +67,14 @@ var _ = BeforeSuite(func(done Done) {
6767
err = infrav1.AddToScheme(scheme.Scheme)
6868
Expect(err).NotTo(HaveOccurred())
6969

70-
err = infrav1.AddToScheme(scheme.Scheme)
71-
Expect(err).NotTo(HaveOccurred())
70+
framework.TryAddDefaultSchemes(scheme.Scheme)
7271

7372
// +kubebuilder:scaffold:scheme
7473

7574
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
7675
Expect(err).ToNot(HaveOccurred())
7776
Expect(k8sClient).ToNot(BeNil())
78-
79-
close(done)
80-
}, 60)
77+
})
8178

8279
var _ = AfterSuite(func() {
8380
By("tearing down the test environment")

0 commit comments

Comments
 (0)