From a7321d0668123a5aece127ceef549be4f3d797a7 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Fri, 16 Jun 2023 10:35:56 +0800 Subject: [PATCH] waiting the approved csr if it is not found in integration test Signed-off-by: Wei Liu --- build/Dockerfile.placement | 2 +- build/Dockerfile.registration | 2 +- build/Dockerfile.registration-operator | 2 +- build/Dockerfile.work | 2 +- .../spokecluster_autoapproval_test.go | 23 +++++++++---------- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/build/Dockerfile.placement b/build/Dockerfile.placement index e1c0e1410..373beb0ad 100644 --- a/build/Dockerfile.placement +++ b/build/Dockerfile.placement @@ -1,4 +1,4 @@ -FROM golang:1.20 AS builder +FROM golang:1.20-bullseye AS builder ARG OS=linux ARG ARCH=amd64 WORKDIR /go/src/open-cluster-management.io/ocm diff --git a/build/Dockerfile.registration b/build/Dockerfile.registration index 3e7e847b9..2f58ec75e 100644 --- a/build/Dockerfile.registration +++ b/build/Dockerfile.registration @@ -1,4 +1,4 @@ -FROM golang:1.20 AS builder +FROM golang:1.20-bullseye AS builder ARG OS=linux ARG ARCH=amd64 WORKDIR /go/src/open-cluster-management.io/ocm diff --git a/build/Dockerfile.registration-operator b/build/Dockerfile.registration-operator index 0c3d66a7e..f603c1a57 100644 --- a/build/Dockerfile.registration-operator +++ b/build/Dockerfile.registration-operator @@ -1,4 +1,4 @@ -FROM golang:1.20 AS builder +FROM golang:1.20-bullseye AS builder ARG OS=linux ARG ARCH=amd64 WORKDIR /go/src/open-cluster-management.io/ocm diff --git a/build/Dockerfile.work b/build/Dockerfile.work index e22f8631e..f0e8303d1 100644 --- a/build/Dockerfile.work +++ b/build/Dockerfile.work @@ -1,4 +1,4 @@ -FROM golang:1.20 AS builder +FROM golang:1.20-bullseye AS builder ARG OS=linux ARG ARCH=amd64 WORKDIR /go/src/open-cluster-management.io/ocm diff --git a/test/integration/registration/spokecluster_autoapproval_test.go b/test/integration/registration/spokecluster_autoapproval_test.go index 6a58f39f9..6715d6d88 100644 --- a/test/integration/registration/spokecluster_autoapproval_test.go +++ b/test/integration/registration/spokecluster_autoapproval_test.go @@ -42,22 +42,21 @@ var _ = ginkgo.Describe("Cluster Auto Approval", func() { cancel := runAgent("autoapprovaltest", agentOptions, spokeCfg) defer cancel() - gomega.Eventually(func() error { - if _, err := util.GetManagedCluster(clusterClient, managedClusterName); err != nil { - return err + // after bootstrap the spokecluster should be accepted and its csr should be auto approved + gomega.Eventually(func() bool { + cluster, err := util.GetManagedCluster(clusterClient, managedClusterName) + if err != nil { + return false } - return nil - }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) + + return cluster.Spec.HubAcceptsClient + }, eventuallyTimeout, eventuallyInterval).Should(gomega.BeTrue()) var approvedCSR *certificates.CertificateSigningRequest - // after bootstrap the spokecluster csr should be auto approved - gomega.Eventually(func() error { + gomega.Eventually(func() bool { approvedCSR, err = util.FindAutoApprovedSpokeCSR(kubeClient, managedClusterName) - if err != nil { - return err - } - return nil - }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) + return err == nil + }, eventuallyTimeout, eventuallyInterval).Should(gomega.BeTrue()) // simulate hub cluster to fill a certificate now := time.Now()