mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-01 07:47:15 +00:00
tests: confidential: Add KBS logging
For help with debugging add, logging of the KBS, like the container system logs if the confidential test fails Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
parent
57527c1ce4
commit
52b2662b75
@ -207,3 +207,16 @@ function create_coco_pod_yaml_with_annotations() {
|
||||
set_node "${kata_pod}" "$node"
|
||||
fi
|
||||
}
|
||||
|
||||
confidential_teardown_common() {
|
||||
local node="$1"
|
||||
local node_start_time="$2"
|
||||
|
||||
# Run common teardown
|
||||
teardown_common "${node}" ${node_start_time}
|
||||
|
||||
# Also try and print the kbs logs on failure
|
||||
if [[ -n "${node_start_time}" && -z "${BATS_TEST_COMPLETED}" ]]; then
|
||||
kbs_k8s_print_logs "${node_start_time}"
|
||||
fi
|
||||
}
|
||||
|
@ -463,6 +463,18 @@ kbs_k8s_svc_http_addr() {
|
||||
echo "http://${host}:${port}"
|
||||
}
|
||||
|
||||
kbs_k8s_print_logs() {
|
||||
local start_time="$1"
|
||||
|
||||
# Convert to iso time for kubectl
|
||||
local iso_start_time
|
||||
iso_start_time=$(date -d "${start_time}" --iso-8601=seconds)
|
||||
|
||||
echo "::group::DEBUG - kbs logs since ${start_time}"
|
||||
kubectl -n "${KBS_NS}" logs -l app=kbs --since-time="${iso_start_time}" --timestamps=true || true
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
# Ensure rust is installed in the host.
|
||||
#
|
||||
# It won't install rust if it's already present, however, if the current
|
||||
|
@ -90,5 +90,5 @@ teardown() {
|
||||
skip "Test skipped as KBS not setup"
|
||||
fi
|
||||
|
||||
teardown_common "${node}" "${node_start_time:-}"
|
||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
||||
}
|
||||
|
@ -110,6 +110,6 @@ teardown() {
|
||||
|
||||
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
||||
|
||||
teardown_common "${node}" "${node_start_time:-}"
|
||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
||||
kubectl delete secret cococred --ignore-not-found
|
||||
}
|
||||
|
@ -95,5 +95,5 @@ teardown() {
|
||||
|
||||
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
||||
|
||||
teardown_common "${node}" "${node_start_time:-}"
|
||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ teardown() {
|
||||
skip "Test skipped as KBS not setup"
|
||||
fi
|
||||
|
||||
teardown_common "${node}" "${node_start_time:-}"
|
||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
||||
kubectl delete secret sealed-secret --ignore-not-found
|
||||
kubectl delete secret not-sealed-secret --ignore-not-found
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user