Skip to content

Commit

Permalink
waiting the approved csr if it is not found in integration test (#188)
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Liu <liuweixa@redhat.com>
  • Loading branch information
skeeey authored Jun 16, 2023
1 parent ecfb6c0 commit 946e22e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build/Dockerfile.placement
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.registration
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.registration-operator
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile.work
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 11 additions & 12 deletions test/integration/registration/spokecluster_autoapproval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 946e22e

Please sign in to comment.