e2e: Test that all operators are stable
This should catch flakes or failure retries
@@ -80,9 +80,8 @@ var _ = g.Describe("[Feature:Platform][Smoke] Managed cluster should", func() {
// gate on all clusteroperators being ready
available := make(map[string]struct{})
- for _, group := range []string{"config.openshift.io"} {
- g.By(fmt.Sprintf("waiting for all cluster operators in %s to be available", group))
- coc := dc.Resource(schema.GroupVersionResource{Group: group, Resource: "clusteroperators", Version: "v1"})
+ g.By(fmt.Sprintf("waiting for all cluster operators to be stable at the same time"))
+ coc := dc.Resource(schema.GroupVersionResource{Group: "config.openshift.io", Resource: "clusteroperators", Version: "v1"})
lastErr = nil
var lastCOs []objx.Map
wait.PollImmediate(time.Second, operatorWait, func() (bool, error) {
@@ -97,10 +96,8 @@ var _ = g.Describe("[Feature:Platform][Smoke] Managed cluster should", func() {
items := objects(cv.Get("items"))
lastCOs = items
- // TODO: make this an error condition once we know at least one cluster operator status is reported
if len(items) == 0 {
- e2e.Logf("No cluster operators registered in %s", group)
- return true, nil
+ return false, nil
}
var unavailable []objx.Map
@@ -113,9 +110,23 @@ var _ = g.Describe("[Feature:Platform][Smoke] Managed cluster should", func() {
unavailable = append(unavailable, co)
break
}
+ if condition(co, "Progressing").Get("status").String() != "False" {
+ ns := co.Get("metadata.namespace").String()
+ name := co.Get("metadata.name").String()
+ unavailableNames = append(unavailableNames, fmt.Sprintf("%s/%s", ns, name))
+ unavailable = append(unavailable, co)
+ break
+ }
+ if condition(co, "Failing").Get("status").String() != "False" {
+ ns := co.Get("metadata.namespace").String()
+ name := co.Get("metadata.name").String()
+ unavailableNames = append(unavailableNames, fmt.Sprintf("%s/%s", ns, name))
+ unavailable = append(unavailable, co)
+ break
+ }
}
if len(unavailable) > 0 {
- e2e.Logf("Operators in group %s still unavailable: %s", group, strings.Join(unavailableNames, ", "))
+ e2e.Logf("Operators still doing work: %s", strings.Join(unavailableNames, ", "))
return false, nil
}
return true, nil
@@ -145,15 +156,13 @@ var _ = g.Describe("[Feature:Platform][Smoke] Managed cluster should", func() {
}
w.Flush()
e2e.Logf("ClusterOperators:\n%s", buf.String())
- // TODO: make this an e2e.Failf()
+
if len(unavailable) > 0 {
- e2e.Logf("Some cluster operators never became available %s", strings.Join(unavailable, ", "))
+ e2e.Failf("Some cluster operators never became available %s", strings.Join(unavailable, ", "))
}
- }
-
// Check at least one core operator is available
if len(available) == 0 {
- e2e.Failf("None of the required core operators are available")
+ e2e.Failf("There must be at least one cluster operator")
}
})
})
