mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 00:37:24 +00:00
tests: Add kubernetes stability test
This PR adds a k8s stability test that will be part of the CoCo Kata stability tests that will run weekly. Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
parent
99730256a2
commit
d48ad94825
55
tests/stability/kubernetes_stability.sh
Executable file
55
tests/stability/kubernetes_stability.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -o pipefail
|
||||
set -x
|
||||
|
||||
SCRIPT_PATH=$(dirname "$(readlink -f "$0")")
|
||||
source "${SCRIPT_PATH}/../metrics/lib/common.bash"
|
||||
|
||||
# Timeout is the duration of this test (seconds)
|
||||
timeout=3600
|
||||
start_time=$(date +%s)
|
||||
end_time=$((start_time+timeout))
|
||||
|
||||
|
||||
function main() {
|
||||
# Check no processes are left behind
|
||||
check_processes
|
||||
|
||||
# Create pod
|
||||
kubectl create -f "${SCRIPT_PATH}/runtimeclass_workloads/stability-test.yaml"
|
||||
# Verify pod is running
|
||||
pod_name="stability-test"
|
||||
kubectl wait --for=condition=Ready --timeout=30s pod "${pod_name}"
|
||||
|
||||
echo "Running kubernetes stability test"
|
||||
count=0
|
||||
while [[ "${end_time}" > $(date +%s) ]]; do
|
||||
echo "This is the number of iterations $count"
|
||||
count=$((count+1))
|
||||
|
||||
cmd1="echo 'hello world' > file"
|
||||
kubectl exec "${pod_name}" -- /bin/bash -c "${cmd1}"
|
||||
|
||||
cmd2="rm -rf /file"
|
||||
kubectl exec "${pod_name}" -- /bin/bash -c "${cmd2}"
|
||||
|
||||
cmd3="touch /tmp/execWorks"
|
||||
kubectl exec "${pod_name}" -- /bin/bash -c "${cmd3}"
|
||||
|
||||
cmd4="ls /tmp | grep execWorks"
|
||||
kubectl exec "${pod_name}" -- /bin/bash -c "${cmd4}"
|
||||
|
||||
cmd5="rm -rf /tmp/execWorks"
|
||||
kubectl exec "${pod_name}" -- /bin/bash -c "${cmd5}"
|
||||
done
|
||||
|
||||
kubectl delete -f "${SCRIPT_PATH}/runtimeclass_workloads/stability-test.yaml"
|
||||
}
|
||||
|
||||
main "$@"
|
16
tests/stability/runtimeclass_workloads/stability-test.yaml
Normal file
16
tests/stability/runtimeclass_workloads/stability-test.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (c) 2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: stability-test
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 0
|
||||
runtimeClassName: kata
|
||||
containers:
|
||||
- name: stability-test
|
||||
image: quay.io/bedrock/ubuntu:latest
|
||||
command: ["/bin/sh", "-c", "tail -f /dev/null"]
|
Loading…
Reference in New Issue
Block a user