From 480532ee68162c6f46347b0377f701ba458a9a33 Mon Sep 17 00:00:00 2001 From: Leonard Cohnen Date: Mon, 9 Dec 2024 17:10:42 +0100 Subject: [PATCH] e2e/aks-runtime: filter pods for test container Before, when another pod was deployed into the same namespace because of our logging architecture in the CI, the test failed. --- e2e/aks-runtime/aks_runtime_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/e2e/aks-runtime/aks_runtime_test.go b/e2e/aks-runtime/aks_runtime_test.go index 428a4e6b3..9fad77b08 100644 --- a/e2e/aks-runtime/aks_runtime_test.go +++ b/e2e/aks-runtime/aks_runtime_test.go @@ -10,6 +10,7 @@ import ( "flag" "os" "path" + "strings" "testing" "time" @@ -127,8 +128,15 @@ func TestAKSRuntime(t *testing.T) { t.Log(pods) t.Log(err) require.NoError(err) - require.Len(pods.Items, 1) - pod := pods.Items[0] // only one pod was deployed + + var pod corev1.Pod + for _, p := range pods.Items { + if strings.Contains(p.Name, testContainer) { + pod = p + break + } + } + require.NotEmpty(pod) logs, err := c.Client.CoreV1().Pods(namespace).GetLogs(pod.Name, &corev1.PodLogOptions{}).DoRaw(ctx) require.NoError(err)