tests: k8s-job 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/50326984605?pr=11753

not ok 1 Run a job to completion
 (in test file k8s-job.bats, line 37)
   `kubectl logs "$pod_name" | grep "$pi_number"' failed

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
Dan Mihai
2025-09-16 00:23:25 +00:00
committed by Fabiano Fidêncio
parent 8854e69e28
commit e2992b51ad

View File

@@ -19,6 +19,11 @@ setup() {
}
@test "Run a job to completion" {
local cmd
local logs
local pi_number
local pod_name
# Create job
kubectl apply -f "${yaml_file}"
@@ -33,8 +38,12 @@ setup() {
waitForProcess "$wait_time" "$sleep_time" "$cmd"
# Verify the output of the pod
bats_unbuffered_info "Getting logs for $pod_name"
logs=$(kubectl logs "$pod_name")
bats_unbuffered_info "Logs: $logs"
pi_number="3.14"
kubectl logs "$pod_name" | grep "$pi_number"
echo "$logs" | grep "$pi_number"
}
teardown() {