From 8854e69e286727f4cea108263818218132bda484 Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Tue, 16 Sep 2025 00:05:59 +0000 Subject: [PATCH] tests: k8s-empty-dirs debug information Log the output of "kubectl logs", to hopefully help understand test failures similar to: https://github.com/kata-containers/kata-containers/actions/runs/17709473340/job/50326984613?pr=11753 not ok 2 Empty dir volume when FSGroup is specified with non-root container (from function `assert_equal' in file k8s-empty-dirs.bats, line 16, in test file k8s-empty-dirs.bats, line 65) `assert_equal "1001" "$uid"' failed Signed-off-by: Dan Mihai --- tests/integration/kubernetes/k8s-empty-dirs.bats | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/integration/kubernetes/k8s-empty-dirs.bats b/tests/integration/kubernetes/k8s-empty-dirs.bats index 78a3810c3d..0a46f5a1a6 100644 --- a/tests/integration/kubernetes/k8s-empty-dirs.bats +++ b/tests/integration/kubernetes/k8s-empty-dirs.bats @@ -43,6 +43,15 @@ setup() { } @test "Empty dir volume when FSGroup is specified with non-root container" { + local agnhost_name + local agnhost_version + local gid + local image + local logs + local pod_file + local pod_logs_file + local uid + [[ "${KATA_HYPERVISOR}" = qemu-se* ]] && \ skip "See: https://github.com/kata-containers/kata-containers/issues/10002" # This is a reproducer of k8s e2e "[sig-storage] EmptyDir volumes when FSGroup is specified [LinuxOnly] [NodeFeature:FSGroup] new files should be created with FSGroup ownership when container is non-root" test @@ -59,7 +68,11 @@ setup() { pod_logs_file="$(mktemp)" for container in mounttest-container mounttest-container-2; do + bats_unbuffered_info "Getting logs for $container" kubectl logs "$pod_name" "$container" > "$pod_logs_file" + logs=$(cat $pod_logs_file) + bats_unbuffered_info "Logs: $logs" + # Check owner UID of file uid=$(cat $pod_logs_file | grep 'owner UID of' | sed 's/.*:\s//') assert_equal "1001" "$uid"