Skip to content

Commit

Permalink
try a different fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Feb 28, 2024
1 parent 014f4c8 commit 215c67a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/framework/ownerreference_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"reflect"
"sort"
"strings"
"time"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -103,10 +104,20 @@ func AssertOwnerReferences(namespace, kubeconfigPath string, assertFuncs ...map[
allAssertFuncs[k] = v
}
}
var graph clusterctlcluster.OwnerGraph
Eventually(func() error {
var err error
graph, err = clusterctlcluster.GetOwnerGraph(namespace, kubeconfigPath)
// Sometimes the conversion-webhooks are not ready yet / cert-managers ca-injector
// may not yet have injected the new ca bundle after the upgrade.
// If this is not the case we fail fast.
if err != nil && !strings.Contains(err.Error(), "x509: certificate signed by unknown authority") {
Expect(err).ToNot(HaveOccurred())
}
return err
}).WithTimeout(3 * time.Minute).WithPolling(2 * time.Second).Should(Succeed())
Eventually(func() error {
allErrs := []error{}
graph, err := clusterctlcluster.GetOwnerGraph(namespace, kubeconfigPath)
Expect(err).ToNot(HaveOccurred())
for _, v := range graph {
if _, ok := allAssertFuncs[v.Object.Kind]; !ok {
allErrs = append(allErrs, fmt.Errorf("kind %s does not have an associated ownerRef assertion function", v.Object.Kind))
Expand Down

0 comments on commit 215c67a

Please sign in to comment.