kata-containers/tests/integration/kubernetes/k8s-kill-all-process-in-container.bats
Dan Mihai 17d22cae34 tests: use unique test name
k8s-pid-ns.bats was already using the test name from
k8s-kill-all-process-in-container.bats - probably a copy/paste bug.

Fixes: #7753

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
(cherry picked from commit 183f51d6f6)
2023-09-21 13:26:18 +02:00

38 lines
898 B
Bash

#!/usr/bin/env bats
#
# Copyright (c) 2022 AntGroup Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
load "${BATS_TEST_DIRNAME}/../../common.bash"
load "${BATS_TEST_DIRNAME}/tests_common.sh"
setup() {
pod_name="busybox"
first_container_name="first-test-container"
get_pod_config_dir
}
@test "Kill all processes in container" {
# Create the pod
kubectl create -f "${pod_config_dir}/initcontainer-shareprocesspid.yaml"
# Check pod creation
kubectl wait --for=condition=Ready --timeout=$timeout pod $pod_name
# Check PID from first container
first_pid_container=$(kubectl exec $pod_name -c $first_container_name \
-- ps | grep "tail" || true)
# Verify that the tail process didn't exist
[ -z $first_pid_container ] || die "found processes pid: $first_pid_container"
}
teardown() {
# Debugging information
kubectl describe "pod/$pod_name"
kubectl delete pod "$pod_name"
}