Skip to content

Commit

Permalink
tests: do not FailNow() when helm upgrade test's assertion fails (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Jun 19, 2024
1 parent bf32872 commit 0781df2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/e2e/test_helm_install_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func getGatewayByLabelSelector(gatewayLabelSelector string, ctx context.Context,
lReq, err := labels.ParseToRequirements(gatewayLabelSelector)
if err != nil {
c.Errorf("failed to parse label selector %q: %v", gatewayLabelSelector, err)
c.FailNow()
return nil
}
lSel := labels.NewSelector()
for _, req := range lReq {
Expand All @@ -433,6 +433,9 @@ func getGatewayByLabelSelector(gatewayLabelSelector string, ctx context.Context,
func gatewayAndItsListenersAreProgrammedAssertion(gatewayLabelSelector string) func(context.Context, *assert.CollectT, client.Client) {
return func(ctx context.Context, c *assert.CollectT, cl client.Client) {
gw := getGatewayByLabelSelector(gatewayLabelSelector, ctx, c, cl)
if !assert.NotNil(c, gw) {
return
}
assert.True(c, gateway.IsProgrammed(gw))
assert.True(c, gateway.AreListenersProgrammed(gw))
}
Expand All @@ -443,19 +446,22 @@ func gatewayAndItsListenersAreProgrammedAssertion(gatewayLabelSelector string) f
func gatewayDataPlaneDeploymentIsNotPatched(gatewayLabelSelector string) func(context.Context, *assert.CollectT, client.Client) {
return func(ctx context.Context, c *assert.CollectT, cl client.Client) {
gw := getGatewayByLabelSelector(gatewayLabelSelector, ctx, c, cl)
if !assert.NotNil(c, gw) {
return
}

dataplanes, err := gateway.ListDataPlanesForGateway(ctx, cl, gw)
if err != nil {
c.Errorf("failed to list DataPlanes for Gateway %q: %v", client.ObjectKeyFromObject(gw), err)
c.FailNow()
return
}
if !assert.Len(c, dataplanes, 1) {
return
}
dp := &dataplanes[0]
if dp.Generation != 1 {
c.Errorf("DataPlane %q got patched but it shouldn't: %v", client.ObjectKeyFromObject(dp), err)
c.FailNow()
return
}
}
}
Expand All @@ -466,7 +472,7 @@ func clusterWideResourcesAreProperlyManaged(gatewayLabelSelector string) func(ct
controlplanes, err := gateway.ListControlPlanesForGateway(ctx, cl, gw)
if err != nil {
c.Errorf("failed to list ControlPlanes for Gateway %q: %v", client.ObjectKeyFromObject(gw), err)
c.FailNow()
return
}
if !assert.Len(c, controlplanes, 1) {
return
Expand Down

0 comments on commit 0781df2

Please sign in to comment.