Skip to content

Commit 30cd193

Browse files
authored
[e2e] relax skip_permissions assertions (#9014)
* relax skip_permissions assertions * consistency
1 parent a29cbfb commit 30cd193

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

test/rekt/features/apiserversource/skip_permissions.go

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -255,25 +255,17 @@ func SkipPermissionsEnabledWithRBACFeature() *feature.Feature {
255255

256256
var obj *appsv1.Deployment
257257
for _, deployment := range objs.Items {
258-
if strings.HasPrefix(deployment.Name, "apiserversource-two-") {
258+
if strings.HasPrefix(deployment.Name, "apiserversource-two-") && deployment.Status.ReadyReplicas >= 1 {
259259
obj = &deployment
260260
break
261261
}
262262
}
263263

264264
if obj == nil {
265-
t.Fatal("could not found a Deployment prefixed with 'apiserversource-two-'")
265+
t.Fatal("could not find a Deployment prefixed with 'apiserversource-two-' with at least 1 readyReplica")
266266
return
267267
}
268268

269-
if obj.Status.ReadyReplicas != 1 {
270-
t.Fatalf("Expected 1 ready replica, got: %d", obj.Status.ReadyReplicas)
271-
}
272-
273-
if obj.Status.UnavailableReplicas != 0 {
274-
t.Fatalf("Expected 0 unavailable replica, got: %d", obj.Status.UnavailableReplicas)
275-
}
276-
277269
for _, envvar := range obj.Spec.Template.Spec.Containers[0].Env {
278270
if envvar.Name == "K_SOURCE_CONFIG" {
279271
var config apiserver.Config
@@ -482,25 +474,17 @@ func SkipPermissionsDisabledWithRBACFeature() *feature.Feature {
482474

483475
var obj *appsv1.Deployment
484476
for _, deployment := range objs.Items {
485-
if strings.HasPrefix(deployment.Name, "apiserversource-four-") {
477+
if strings.HasPrefix(deployment.Name, "apiserversource-four-") && deployment.Status.ReadyReplicas >= 1 {
486478
obj = &deployment
487479
break
488480
}
489481
}
490482

491483
if obj == nil {
492-
t.Fatal("could not found a Deployment prefixed with 'apiserversource-four-'")
484+
t.Fatal("could not find a Deployment prefixed with 'apiserversource-four-' with at least 1 readyReplica")
493485
return
494486
}
495487

496-
if obj.Status.ReadyReplicas != 1 {
497-
t.Fatalf("Expected 1 ready replica, got: %d", obj.Status.ReadyReplicas)
498-
}
499-
500-
if obj.Status.UnavailableReplicas != 0 {
501-
t.Fatalf("Expected 0 unavailable replica, got: %d", obj.Status.UnavailableReplicas)
502-
}
503-
504488
for _, envvar := range obj.Spec.Template.Spec.Containers[0].Env {
505489
if envvar.Name == "K_SOURCE_CONFIG" {
506490
var config apiserver.Config

0 commit comments

Comments
 (0)