Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHOAIENG-15772: tests(odh-nbc): wait for controller manager to stop before stopping envtest #463

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions components/odh-notebook-controller/controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@
// +kubebuilder:docs-gen:collapse=Imports

var (
cfg *rest.Config
cli client.Client
envTest *envtest.Environment
cfg *rest.Config

Check failure on line 58 in components/odh-notebook-controller/controllers/suite_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint (components/odh-notebook-controller)

var `cfg` is unused (unused)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter is right, but that's issue that has been in the repo for a long time already. See here for fix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/override "Code static analysis / golangci-lint (components/odh-notebook-controller)"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/override "Code static analysis / golangci-lint (components/odh-notebook-controller)"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/override "golangci-lint (components/odh-notebook-controller)"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I rebased merged

cli client.Client
envTest *envtest.Environment

ctx context.Context
cancel context.CancelFunc
managerStopped = make(chan struct{})

testNamespaces = []string{}
)

Expand All @@ -74,7 +77,7 @@
}

var _ = BeforeSuite(func() {
ctx, cancel = context.WithCancel(context.TODO())
ctx, cancel = context.WithCancel(context.Background())

// Initialize logger
opts := zap.Options{
Expand Down Expand Up @@ -156,6 +159,7 @@
go func() {
defer GinkgoRecover()
err = mgr.Start(ctx)
managerStopped <- struct{}{}
Expect(err).ToNot(HaveOccurred(), "Failed to run manager")
}()

Expand Down Expand Up @@ -187,7 +191,10 @@
}, 60)

var _ = AfterSuite(func() {
By("Stopping the manager")
cancel()
<-managerStopped // Issue#429: waiting to avoid shutdown errors being logged

By("Tearing down the test environment")
// TODO: Stop cert controller-runtime.certwatcher before manager
err := envTest.Stop()
Expand Down
Loading