From 806d63d1d8584579bb0248906a0b4c8337968565 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Wed, 2 Jul 2025 16:36:48 -0300 Subject: [PATCH] tests/k8s: call teardown_common in k8s-credentials-secrets.bats The teardown_common will print the description of the running pods, kill them all and print the system's syslogs afterwards. Signed-off-by: Wainer dos Santos Moschetta --- .../kubernetes/k8s-credentials-secrets.bats | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/integration/kubernetes/k8s-credentials-secrets.bats b/tests/integration/kubernetes/k8s-credentials-secrets.bats index 5969c38b29..7035c70fb9 100644 --- a/tests/integration/kubernetes/k8s-credentials-secrets.bats +++ b/tests/integration/kubernetes/k8s-credentials-secrets.bats @@ -6,16 +6,19 @@ # load "${BATS_TEST_DIRNAME}/../../common.bash" +load "${BATS_TEST_DIRNAME}/lib.sh" load "${BATS_TEST_DIRNAME}/tests_common.sh" setup() { [ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}" [ "${KATA_HYPERVISOR}" == "fc" ] && skip "test not working see: ${fc_limitations}" + setup_common get_pod_config_dir # Add policy to pod-secret.yaml. pod_yaml_file="${pod_config_dir}/pod-secret.yaml" + set_node "$pod_yaml_file" "$node" pod_cmd="ls /tmp/secret-volume" pod_exec_command=(sh -c "${pod_cmd}") pod_policy_settings_dir="$(create_tmp_policy_settings_dir "${pod_config_dir}")" @@ -28,6 +31,7 @@ setup() { # TODO: auto-generate policy for this pod YAML after solving # https://github.com/kata-containers/kata-containers/issues/10033 pod_env_yaml_file="${pod_config_dir}/pod-secret-env.yaml" + set_node "$pod_env_yaml_file" "$node" pod_env_cmd="printenv" pod_env_exec_command=(sh -c "${pod_env_cmd}") add_allow_all_policy_to_yaml "${pod_env_yaml_file}" @@ -69,12 +73,9 @@ teardown() { [ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}" [ "${KATA_HYPERVISOR}" == "fc" ] && skip "test not working see: ${fc_limitations}" - # Debugging information - kubectl describe "pod/$pod_name" - kubectl describe "pod/$second_pod_name" - - kubectl delete pod "$pod_name" "$second_pod_name" kubectl delete secret "$secret_name" delete_tmp_policy_settings_dir "${pod_policy_settings_dir}" + + teardown_common "${node}" "${node_start_time:-}" }