From 509e6da9656f5157f9f02785aed9f7ea989afee0 Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Fri, 7 Mar 2025 19:28:00 +0000 Subject: [PATCH] tests: k8s-env.bats: log exec output Log the "kubectl exec" ouput, just in case it helps investigate sporadic test errors like: https://github.com/kata-containers/kata-containers/actions/runs/13724022494/job/38387329321?pr=10973 not ok 1 Environment variables (in test file k8s-env.bats, line 37) `grep "HOST_IP=\([0-9]\+\(\.\|$\)\)\{4\}"' failed It appears that the first exec from this test case produced the expected output: MY_POD_NAME=test-env but the second exec produced something else - that will be logged after this change. Signed-off-by: Dan Mihai --- tests/integration/kubernetes/k8s-env.bats | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/integration/kubernetes/k8s-env.bats b/tests/integration/kubernetes/k8s-env.bats index 96b117be2b..ad382a81c7 100644 --- a/tests/integration/kubernetes/k8s-env.bats +++ b/tests/integration/kubernetes/k8s-env.bats @@ -32,14 +32,14 @@ setup() { kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name" # Print environment variables - kubectl exec $pod_name -- "${exec_command[@]}" | grep "MY_POD_NAME=$pod_name" - kubectl exec $pod_name -- "${exec_command[@]}" | \ - grep "HOST_IP=\([0-9]\+\(\.\|$\)\)\{4\}" + grep_pod_exec_output "${pod_name}" "MY_POD_NAME=${pod_name}" "${exec_command[@]}" + grep_pod_exec_output "${pod_name}" "HOST_IP=\([0-9]\+\(\.\|$\)\)\{4\}" "${exec_command[@]}" + # Requested 32Mi of memory - kubectl exec $pod_name -- "${exec_command[@]}" | \ - grep "MEMORY_REQUESTS=$((1024 * 1024 * 32))" + grep_pod_exec_output "${pod_name}" "MEMORY_REQUESTS=$((1024 * 1024 * 32))" "${exec_command[@]}" + # Memory limits allocated by the node - kubectl exec $pod_name -- "${exec_command[@]}" | grep "MEMORY_LIMITS=[1-9]\+" + grep_pod_exec_output "${pod_name}" "MEMORY_LIMITS=[1-9]\+" "${exec_command[@]}" } teardown() {