waiting the approved csr if it is not found in integration test (#188)

Signed-off-by: Wei Liu <liuweixa@redhat.com>
This commit is contained in:
Wei Liu
2023-06-16 14:29:42 +08:00
committed by GitHub
parent ecfb6c0888
commit 946e22eaa9
5 changed files with 15 additions and 16 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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()