From b686d616d375ae97e35e1692d5c147139fc6971c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 3 Oct 2024 13:47:40 +0200 Subject: [PATCH] tests: fix helm upgrade test by checking DataPlane's deployment not the DataPlane itself --- test/e2e/test_helm_install_upgrade.go | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/test/e2e/test_helm_install_upgrade.go b/test/e2e/test_helm_install_upgrade.go index 759b3b860..7ab72f510 100644 --- a/test/e2e/test_helm_install_upgrade.go +++ b/test/e2e/test_helm_install_upgrade.go @@ -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" @@ -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 } }