From bdca5ca1456f343e287fed13e0f69cfe80839a1e Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Mon, 12 Aug 2024 22:51:50 +0000 Subject: [PATCH] tests: Add kubernetes stress-ng tests This PR adds kubernetes stress-ng tests as part of the stability testing for kata. Signed-off-by: Gabriela Cervantes --- tests/stability/kubernetes_stressng.sh | 39 +++++++++++++++++++ .../runtimeclass_workloads/stress-test.yaml | 16 ++++++++ 2 files changed, 55 insertions(+) create mode 100755 tests/stability/kubernetes_stressng.sh create mode 100644 tests/stability/runtimeclass_workloads/stress-test.yaml diff --git a/tests/stability/kubernetes_stressng.sh b/tests/stability/kubernetes_stressng.sh new file mode 100755 index 0000000000..34233b13ef --- /dev/null +++ b/tests/stability/kubernetes_stressng.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright (c) 2024 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +set -o pipefail + +SCRIPT_PATH=$(dirname "$(readlink -f "$0")") +source "${SCRIPT_PATH}/../metrics/lib/common.bash" + +function main() { + # Check no processes are left behind + check_processes + # Create pod + kubectl create -f "${SCRIPT_PATH}/runtimeclass_workloads/stress-test.yaml" + # Verify pod is running + pod_name="stressng-test" + kubectl wait --for=condition=Ready --timeout=30s pod "${pod_name}" + + echo "Running stress matrix test" + cmd1="stress-ng --matrix 0 -t 60m" + kubectl exec "${pod_name}" -- /bin/bash -c "${cmd1}" + + echo "Running stress cpu test" + cmd2="stress-ng --cpu 0 --vm 2 -t 60m" + kubectl exec "${pod_name}" -- /bin/bash -c "${cmd2}" + + echo "Running stress io test" + cmd3="stress-ng --io 2 -t 60m" + kubectl exec "${pod_name}" -- /bin/bash -c "${cmd3}" + + kubectl delete -f "${SCRIPT_PATH}/runtimeclass_workloads/stress-test.yaml" + kubectl delete pod "${pod_name}" + check_processes +} + +main "$@" diff --git a/tests/stability/runtimeclass_workloads/stress-test.yaml b/tests/stability/runtimeclass_workloads/stress-test.yaml new file mode 100644 index 0000000000..0196548ec4 --- /dev/null +++ b/tests/stability/runtimeclass_workloads/stress-test.yaml @@ -0,0 +1,16 @@ +# +# Copyright (c) 2024 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# +apiVersion: v1 +kind: Pod +metadata: + name: stressng-test +spec: + terminationGracePeriodSeconds: 0 + runtimeClassName: kata + containers: + - name: stress-test + image: quay.io/container-perf-tools/stress-ng + command: ["/bin/sh", "-c", "tail -f /dev/null"]