test/extended/project: deflake in HA environments waiting for all instances
@@ -471,6 +471,8 @@ var _ = g.Describe("[Feature:ProjectAPI] ", func() {
// wait for evaluation errors to show up in both namespaces and at cluster scope
err = wait.PollImmediate(100*time.Millisecond, 10*time.Second, func() (bool, error) {
+ // do this 10 times to be sure that all API server instances have converged
+ for i := 0; i < 10; i++ {
review := &authorizationv1.ResourceAccessReview{Action: authorizationv1.Action{Verb: "get", Resource: "pods"}}
review.Action.Namespace = fooName
if resp, err := clusterAdminAuthorizationClient.ResourceAccessReviews().Create(review); err != nil || resp.EvaluationError == "" {
@@ -484,6 +486,7 @@ var _ = g.Describe("[Feature:ProjectAPI] ", func() {
if resp, err := clusterAdminAuthorizationClient.ResourceAccessReviews().Create(review); err != nil || resp.EvaluationError == "" {
return false, err
}
+ }
return true, nil
})
o.Expect(err).NotTo(o.HaveOccurred())
@@ -505,8 +508,9 @@ var _ = g.Describe("[Feature:ProjectAPI] ", func() {
for _, project := range projects.Items {
projectNames.Insert(project.Name)
}
- if !projectNames.HasAll(fooName, barName, "openshift-infra", "openshift", "default") {
- g.Fail(fmt.Sprintf("Expected projects %q and %q, got %v", fooName, barName, projectNames.List()))
+ expected := []string{fooName, barName, "openshift-infra", "openshift", "default"}
+ if !projectNames.HasAll(expected...) {
+ g.Fail(fmt.Sprintf("Expected projects %v among %v", expected, projectNames.List()))
}
})
})
