From f6c3f1754988cd96fd8135bbdc00fdabeb9939a0 Mon Sep 17 00:00:00 2001 From: Hyeongju Johannes Lee Date: Thu, 25 Nov 2021 09:32:25 -0800 Subject: [PATCH] ci: use 1.22.1 ver of K8s instead of 1.20.2 Update suite_test to support kubernetes 1.21+ version Signed-off-by: Hyeongju Johannes Lee --- .github/workflows/ci.yaml | 2 +- Jenkinsfile | 2 +- test/envtest/suite_test.go | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 09818838..52a0e313 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ on: env: RUNC_VERSION: v1.0.2 GO_VERSION: 1.17.2 - K8S_VERSION: 1.20.2 + K8S_VERSION: 1.22.1 jobs: golangci: diff --git a/Jenkinsfile b/Jenkinsfile index 1d8da7f3..2017ab94 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { REG="cloud-native-image-registry.westus.cloudapp.azure.com/" RUNC_VERSION="v1.0.2" CRIO_VERSION="v1.20.0" - K8S_VERSION="1.20.2" + K8S_VERSION="1.22.1" GOLANGCI_LINT_VERSION="v1.42.0" GO_VERSION="1.17.2" GO_TAR="go${GO_VERSION}.linux-amd64.tar.gz" diff --git a/test/envtest/suite_test.go b/test/envtest/suite_test.go index 353d3a42..c59d4e74 100644 --- a/test/envtest/suite_test.go +++ b/test/envtest/suite_test.go @@ -15,6 +15,7 @@ package envtest import ( + "context" "path/filepath" "testing" @@ -44,6 +45,8 @@ var cfg *rest.Config var k8sClient client.Client var k8sManager ctrl.Manager var testEnv *envtest.Environment +var ctx context.Context +var cancel context.CancelFunc func TestAPIs(t *testing.T) { RegisterFailHandler(Fail) @@ -54,6 +57,7 @@ func TestAPIs(t *testing.T) { var _ = BeforeSuite(func() { logf.SetLogger(klogr.New()) + ctx, cancel = context.WithCancel(context.TODO()) By("bootstrapping test environment") testEnv = &envtest.Environment{ @@ -89,7 +93,7 @@ var _ = BeforeSuite(func() { Expect(err).ToNot(HaveOccurred()) go func() { - err = k8sManager.Start(ctrl.SetupSignalHandler()) + err = k8sManager.Start(ctx) Expect(err).ToNot(HaveOccurred()) }() @@ -99,6 +103,7 @@ var _ = BeforeSuite(func() { }, 60) var _ = AfterSuite(func() { + cancel() By("tearing down the test environment") err := testEnv.Stop() Expect(err).ToNot(HaveOccurred())