From 1d6c1d16218f2ceb224631b601ba09602652b534 Mon Sep 17 00:00:00 2001 From: stevenhorsman Date: Fri, 28 Jun 2024 16:30:43 +0100 Subject: [PATCH] test: Add journal logging for debug - Due to the error we hit with pulling the agnhost image used in the liveness-probe tests, we want to leave the console printing to help with debug when we next try to bump the image-rs version Signed-off-by: stevenhorsman --- .../integration/kubernetes/k8s-liveness-probes.bats | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/integration/kubernetes/k8s-liveness-probes.bats b/tests/integration/kubernetes/k8s-liveness-probes.bats index ea8d51c41e..e0851af504 100644 --- a/tests/integration/kubernetes/k8s-liveness-probes.bats +++ b/tests/integration/kubernetes/k8s-liveness-probes.bats @@ -5,6 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 # +load "${BATS_TEST_DIRNAME}/lib.sh" load "${BATS_TEST_DIRNAME}/../../common.bash" load "${BATS_TEST_DIRNAME}/tests_common.sh" @@ -13,6 +14,7 @@ setup() { agnhost_name="${container_images_agnhost_name}" agnhost_version="${container_images_agnhost_version}" + setup_common get_pod_config_dir } @@ -21,6 +23,7 @@ setup() { yaml_file="${pod_config_dir}/probe-pod-liveness.yaml" cp "${pod_config_dir}/pod-liveness.yaml" "${yaml_file}" + set_node "${yaml_file}" "$node" add_allow_all_policy_to_yaml "${yaml_file}" # Create pod @@ -45,7 +48,7 @@ setup() { sed -e "s#\${agnhost_image}#${agnhost_name}:${agnhost_version}#" \ "${pod_config_dir}/pod-http-liveness.yaml" > "${yaml_file}" - + set_node "${yaml_file}" "$node" add_allow_all_policy_to_yaml "${yaml_file}" # Create pod @@ -71,7 +74,7 @@ setup() { sed -e "s#\${agnhost_image}#${agnhost_name}:${agnhost_version}#" \ "${pod_config_dir}/pod-tcp-liveness.yaml" > "${yaml_file}" - + set_node "${yaml_file}" "$node" add_allow_all_policy_to_yaml "${yaml_file}" # Create pod @@ -95,4 +98,9 @@ teardown() { kubectl delete pod "$pod_name" rm -f "${yaml_file}" + + if [[ -n "${node_start_time}:-}" && -z "$BATS_TEST_COMPLETED" ]]; then + echo "DEBUG: system logs of node '$node' since test start time ($node_start_time)" + print_node_journal "$node" "kata" --since "$node_start_time" || true + fi }