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

Bump testEnv to 1.22 #356

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ install-tools:
@awk -F '"' '/_/ && !/k8s.io\/code-generator/ { system("go install " $$2) }' tools/tools.go
@$(get_mod_code_generator)

ENVTEST_K8S_VERSION = 1.20.2
ENVTEST_K8S_VERSION = 1.22.1
ARCHITECTURE = amd64
LOCAL_TESTBIN = $(CURDIR)/testbin
# "Control plane binaries (etcd and kube-apiserver) are loaded by default from /usr/local/kubebuilder/bin.
# This can be overridden by setting the KUBEBUILDER_ASSETS environment variable"
# https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/envtest
export KUBEBUILDER_ASSETS = $(LOCAL_TESTBIN)/k8s/$(ENVTEST_K8S_VERSION)-$(platform)-$(ARCHITECTURE)

.PHONY: kubebuilder-assets
kubebuilder-assets: $(KUBEBUILDER_ASSETS)

$(KUBEBUILDER_ASSETS):
setup-envtest --os $(platform) --arch $(ARCHITECTURE) --bin-dir $(LOCAL_TESTBIN) use $(ENVTEST_K8S_VERSION)

Expand Down
9 changes: 7 additions & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ var (
testEnv *envtest.Environment
client runtimeClient.Client
clientSet *topologyClient.Clientset
ctx = context.Background()
ctx context.Context
cancel context.CancelFunc
fakeRabbitMQClient *internalfakes.FakeRabbitMQClient
fakeRabbitMQClientError error
fakeRabbitMQClientFactory = func(connectionCreds internal.ConnectionCredentials, tlsEnabled bool, certPool *x509.CertPool) (internal.RabbitMQClient, error) {
Expand All @@ -72,6 +73,9 @@ var (

var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))

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

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{
Expand Down Expand Up @@ -176,7 +180,7 @@ var _ = BeforeSuite(func() {
}

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

Expand Down Expand Up @@ -432,6 +436,7 @@ var _ = AfterEach(func() {

var _ = AfterSuite(func() {
By("tearing down the test environment")
cancel()
Expect(testEnv.Stop()).To(Succeed())
})

Expand Down