Skip to content

Commit

Permalink
Revert "Fix errors during envtest teardown"
Browse files Browse the repository at this point in the history
`make test` is leaking the kube-apiserver and etcd processes.
When unoticed, this causes `make test` to fail with weird
errors like failing to open a file because of rlimit.

Investigation leads to commit 053f866 which was added
to work around the very same problems at the time according to
Pradipta. Reverting this commit fixes the issue.

It seems that updates to the controller-runtime and deps might
have changed something and we no longer need the workaround.

Let's just revert 053f866.

Fixes https://issues.redhat.com/browse/KATA-2168

Signed-off-by: Greg Kurz <groug@kaod.org>
  • Loading branch information
gkurz committed May 16, 2023
1 parent 9553b34 commit 319fd38
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ import (
"os"
"path/filepath"
"testing"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes/scheme"
Expand Down Expand Up @@ -113,15 +111,7 @@ var _ = BeforeSuite(func() {
Expect(err).ToNot(HaveOccurred())

go func() {
defer GinkgoRecover()
err = k8sManager.Start(ctrl.SetupSignalHandler())
Expect(err).ToNot(HaveOccurred(), "failed to run manager")
gexec.KillAndWait(4 * time.Second)

// Teardown the test environment once controller is fnished.
// Otherwise from Kubernetes 1.21+, teardon timeouts waiting on
// kube-apiserver to return
err := testEnv.Stop()
Expect(err).ToNot(HaveOccurred())
}()

Expand All @@ -131,4 +121,6 @@ var _ = BeforeSuite(func() {

var _ = AfterSuite(func() {
By("tearing down the test environment")
err := testEnv.Stop()
Expect(err).ToNot(HaveOccurred())
})

0 comments on commit 319fd38

Please sign in to comment.