Skip to content

Commit

Permalink
Fix it test setup issue for envtest k8s >v1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammet Yazici committed Dec 16, 2022
1 parent e650bb2 commit 6f71771
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/integration/suite_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
"context"
"path/filepath"
"testing"

Expand All @@ -26,6 +27,9 @@ import (
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.

var ctx context.Context
var cancel context.CancelFunc

var (
k8sClient client.Client
testEnv *envtest.Environment
Expand Down Expand Up @@ -115,14 +119,17 @@ var _ = BeforeSuite(func() {
).SetupWithManager(k8sManager)
Expect(err).ToNot(HaveOccurred())

ctx, cancel = context.WithCancel(ctrl.SetupSignalHandler())

go func() {
err = k8sManager.Start(ctrl.SetupSignalHandler())
err = k8sManager.Start(ctx)
Expect(err).ToNot(HaveOccurred())
}()

})

var _ = AfterSuite(func() {
cancel()
By("tearing down the test environment")
err := testEnv.Stop()
Expect(err).NotTo(HaveOccurred())
Expand Down

0 comments on commit 6f71771

Please sign in to comment.