Skip to content

Commit 130b5ec

Browse files
committed
sev: fixed k8s service yaml delete method
bash (ls) regex in quotes was throwing errors and k8s services/pods were not getting cleaned up. Service yamls weren't being deleted due to partial name including prefix file path, now trims using 'basename'. Removed redundant TEST_DIR on the yaml file to be deleted. Fixes: kata-containers#5760 Signed-Off-By: Ryan Savino <[email protected]>
1 parent 7f5a015 commit 130b5ec

File tree

1 file changed

+4
-4
lines changed
  • integration/kubernetes/confidential

1 file changed

+4
-4
lines changed

integration/kubernetes/confidential/sev.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ load "${TESTS_REPO_DIR}/integration/kubernetes/confidential/lib.sh"
2828

2929
# Delete all test services
3030
k8s_delete_all() {
31-
for file in $(ls "${TEST_DIR}/*.yaml") ; do
32-
# Removing extension to get the pod name
33-
local pod_name="${file%.*}"
34-
kubernetes_delete_by_yaml "${pod_name}" "${TEST_DIR}/${file}"
31+
for file in $(find "${TEST_DIR}" -name "*.yaml"); do
32+
# Removing prefix path and file extension to get the pod partial name
33+
local pod_partial_name=$(basename "${file%.*}")
34+
kubernetes_delete_by_yaml "${pod_partial_name}" "${file}"
3535
done
3636
}
3737

0 commit comments

Comments
 (0)