Skip to content

Commit

Permalink
tests: fix helm upgrade test by checking DataPlane's deployment not t…
Browse files Browse the repository at this point in the history
…he DataPlane itself
  • Loading branch information
pmalek committed Oct 3, 2024
1 parent de33602 commit b686d61
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions test/e2e/test_helm_install_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/gruntwork-io/terratest/modules/helm"
"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/kr/pretty"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -533,9 +534,30 @@ func gatewayDataPlaneDeploymentIsNotPatched(gatewayLabelSelector string) func(co
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)

dataplane := &dataplanes[0]
deployments, err := k8sutils.ListDeploymentsForOwner(
ctx,
cl,
dataplane.Namespace,
dataplane.UID,
client.MatchingLabels{
"app": dataplane.Name,
},
)
if !assert.NoError(c, err) {
return
}

if !assert.Len(c, deployments, 1) {
return
}

deployment := &deployments[0]
if deployment.Generation != 1 {
c.Errorf("DataPlane %q Deployment %q got patched but it shouldn't:\n%# v",
client.ObjectKeyFromObject(dataplane), client.ObjectKeyFromObject(deployment), pretty.Formatter(deployment),
)
return
}
}
Expand Down

0 comments on commit b686d61

Please sign in to comment.