mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-15 05:49:05 +00:00
ci: Delete policy settings directory in teardown_common()
This calls delete_tmp_policy_settings_dir() from teardown_common() and removes delete_tmp_policy_settings_dir() calls from tests when teardown_common() is already called. Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
@@ -210,9 +210,10 @@ function create_coco_pod_yaml_with_annotations() {
|
|||||||
confidential_teardown_common() {
|
confidential_teardown_common() {
|
||||||
local node="$1"
|
local node="$1"
|
||||||
local node_start_time="$2"
|
local node_start_time="$2"
|
||||||
|
local policy_settings_dir="$3"
|
||||||
|
|
||||||
# Run common teardown
|
# Run common teardown
|
||||||
teardown_common "${node}" ${node_start_time}
|
teardown_common "${node}" ${node_start_time} "${policy_settings_dir}"
|
||||||
|
|
||||||
# Also try and print the kbs logs on failure
|
# Also try and print the kbs logs on failure
|
||||||
if [[ -n "${node_start_time}" && -z "${BATS_TEST_COMPLETED}" ]]; then
|
if [[ -n "${node_start_time}" && -z "${BATS_TEST_COMPLETED}" ]]; then
|
||||||
|
@@ -90,5 +90,5 @@ teardown() {
|
|||||||
skip "Test skipped as KBS not setup"
|
skip "Test skipped as KBS not setup"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
confidential_teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,5 @@ teardown() {
|
|||||||
|
|
||||||
kubectl delete secret "$secret_name"
|
kubectl delete secret "$secret_name"
|
||||||
|
|
||||||
delete_tmp_policy_settings_dir "${pod_policy_settings_dir}"
|
teardown_common "${node}" "${node_start_time:-}" "${pod_policy_settings_dir}"
|
||||||
|
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
|
||||||
}
|
}
|
||||||
|
@@ -110,6 +110,6 @@ teardown() {
|
|||||||
|
|
||||||
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
||||||
|
|
||||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
confidential_teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
kubectl delete secret cococred --ignore-not-found
|
kubectl delete secret cococred --ignore-not-found
|
||||||
}
|
}
|
||||||
|
@@ -93,5 +93,5 @@ teardown() {
|
|||||||
|
|
||||||
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
||||||
|
|
||||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
confidential_teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
}
|
}
|
||||||
|
@@ -146,5 +146,5 @@ teardown() {
|
|||||||
|
|
||||||
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
||||||
|
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
}
|
}
|
||||||
|
@@ -238,7 +238,7 @@ teardown() {
|
|||||||
|
|
||||||
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
||||||
|
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
kubectl delete --ignore-not-found pvc trusted-pvc
|
kubectl delete --ignore-not-found pvc trusted-pvc
|
||||||
kubectl delete --ignore-not-found pv trusted-block-pv
|
kubectl delete --ignore-not-found pv trusted-block-pv
|
||||||
kubectl delete --ignore-not-found storageclass local-storage
|
kubectl delete --ignore-not-found storageclass local-storage
|
||||||
|
@@ -192,5 +192,5 @@ teardown() {
|
|||||||
|
|
||||||
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
[ "${SNAPSHOTTER:-}" = "nydus" ] || skip "None snapshotter was found but this test requires one"
|
||||||
|
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
}
|
}
|
||||||
|
@@ -42,6 +42,5 @@ teardown() {
|
|||||||
# Debugging information
|
# Debugging information
|
||||||
kubectl logs "$pod_name"
|
kubectl logs "$pod_name"
|
||||||
|
|
||||||
delete_tmp_policy_settings_dir "${policy_settings_dir}"
|
teardown_common "${node}" "${node_start_time:-}" "${policy_settings_dir}"
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
|
||||||
}
|
}
|
||||||
|
@@ -95,5 +95,5 @@ teardown() {
|
|||||||
# Debugging information
|
# Debugging information
|
||||||
rm -f "${yaml_file}"
|
rm -f "${yaml_file}"
|
||||||
|
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
}
|
}
|
||||||
|
@@ -58,5 +58,5 @@ setup() {
|
|||||||
teardown() {
|
teardown() {
|
||||||
check_and_skip
|
check_and_skip
|
||||||
|
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
}
|
}
|
||||||
|
@@ -52,9 +52,7 @@ teardown() {
|
|||||||
rm -f ${pod_config_dir}/job-$i.yaml
|
rm -f ${pod_config_dir}/job-$i.yaml
|
||||||
done
|
done
|
||||||
|
|
||||||
delete_tmp_policy_settings_dir "${policy_settings_dir}"
|
teardown_common "${node}" "${node_start_time:-}" "${policy_settings_dir}"
|
||||||
|
|
||||||
teardown_common
|
|
||||||
|
|
||||||
# Delete jobs
|
# Delete jobs
|
||||||
kubectl delete jobs -l jobgroup=${job_name}
|
kubectl delete jobs -l jobgroup=${job_name}
|
||||||
|
@@ -33,5 +33,5 @@ setup() {
|
|||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
auto_generate_policy_enabled || skip "Auto-generated policy tests are disabled"
|
auto_generate_policy_enabled || skip "Auto-generated policy tests are disabled"
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
teardown_common "${node}" "${node_start_time:-}" "${policy_settings_dir}"
|
||||||
}
|
}
|
||||||
|
@@ -55,5 +55,5 @@ teardown() {
|
|||||||
kubectl logs ${pod}
|
kubectl logs ${pod}
|
||||||
done
|
done
|
||||||
|
|
||||||
teardown_common "${node}" "${node_start_time:-}"
|
teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
}
|
}
|
||||||
|
@@ -115,7 +115,7 @@ teardown() {
|
|||||||
skip "Test skipped as KBS not setup"
|
skip "Test skipped as KBS not setup"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
confidential_teardown_common "${node}" "${node_start_time:-}"
|
confidential_teardown_common "${node}" "${node_start_time:-}" ""
|
||||||
kubectl delete secret sealed-secret --ignore-not-found
|
kubectl delete secret sealed-secret --ignore-not-found
|
||||||
kubectl delete secret not-sealed-secret --ignore-not-found
|
kubectl delete secret not-sealed-secret --ignore-not-found
|
||||||
}
|
}
|
||||||
|
@@ -379,13 +379,16 @@ pod_exec_blocked_command() {
|
|||||||
# Parameters:
|
# Parameters:
|
||||||
# $1 - node name where kata is installed
|
# $1 - node name where kata is installed
|
||||||
# $2 - start time at the node for the sake of fetching logs
|
# $2 - start time at the node for the sake of fetching logs
|
||||||
|
# $3 - policy settings dir (can be empty)
|
||||||
#
|
#
|
||||||
teardown_common() {
|
teardown_common() {
|
||||||
local node="$1"
|
local node="$1"
|
||||||
local node_start_time="$2"
|
local node_start_time="$2"
|
||||||
|
local policy_settings_dir="$3"
|
||||||
|
|
||||||
kubectl describe pods
|
kubectl describe pods
|
||||||
k8s_delete_all_pods_if_any_exists || true
|
k8s_delete_all_pods_if_any_exists || true
|
||||||
|
delete_tmp_policy_settings_dir "${policy_settings_dir}"
|
||||||
|
|
||||||
# Print the node journal since the test start time if a bats test is not completed
|
# Print the node journal since the test start time if a bats test is not completed
|
||||||
if [[ -n "${node_start_time}" && -z "${BATS_TEST_COMPLETED}" ]]; then
|
if [[ -n "${node_start_time}" && -z "${BATS_TEST_COMPLETED}" ]]; then
|
||||||
|
Reference in New Issue
Block a user