Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: do not FailNow() when helm upgrade test's assertion fails #352

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading