diff --git a/internal/kubecmd/kubecmd_test.go b/internal/kubecmd/kubecmd_test.go index 84b064c061..0cc2af2cd8 100644 --- a/internal/kubecmd/kubecmd_test.go +++ b/internal/kubecmd/kubecmd_test.go @@ -11,6 +11,7 @@ import ( "encoding/json" "errors" "io" + "strings" "testing" "time" @@ -436,9 +437,12 @@ func TestUpgradeNodeVersion(t *testing.T) { return } assert.NoError(err) - assert.NotContains(tc.kubectl.updatedConfigMaps[constants.KubeadmConfigMap].Data[constants.ClusterConfigurationKey], "konnectivity-uds") - assert.NotContains(tc.kubectl.updatedConfigMaps[constants.KubeadmConfigMap].Data[constants.ClusterConfigurationKey], "egress-config") - assert.NotContains(tc.kubectl.updatedConfigMaps[constants.KubeadmConfigMap].Data[constants.ClusterConfigurationKey], "egress-selector-config-file") + // The ConfigMap only exists in the updatedConfigMaps map it needed to remove the Konnectivity values + if strings.Contains(tc.kubectl.configMaps[constants.KubeadmConfigMap].Data[constants.ClusterConfigurationKey], "konnectivity-uds") { + assert.NotContains(tc.kubectl.updatedConfigMaps[constants.KubeadmConfigMap].Data[constants.ClusterConfigurationKey], "konnectivity-uds") + assert.NotContains(tc.kubectl.updatedConfigMaps[constants.KubeadmConfigMap].Data[constants.ClusterConfigurationKey], "egress-config") + assert.NotContains(tc.kubectl.updatedConfigMaps[constants.KubeadmConfigMap].Data[constants.ClusterConfigurationKey], "egress-selector-config-file") + } }) } }