gha: Add install dependencies for stability tests

This PR adds the install dependencies for stability tests.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
Gabriela Cervantes 2023-10-09 17:09:32 +00:00
parent 84e3d884e4
commit e786b2b019
3 changed files with 25 additions and 23 deletions

View File

@ -78,6 +78,9 @@ jobs:
env: env:
TARGET_BRANCH: ${{ inputs.target-branch }} TARGET_BRANCH: ${{ inputs.target-branch }}
- name: Install dependencies
run: bash tests/stability/gha-run.sh install-dependencies
- name: get-kata-tarball - name: get-kata-tarball
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:

View File

@ -8,7 +8,6 @@
set -o errexit set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
set -x
kata_tarball_dir="${2:-kata-artifacts}" kata_tarball_dir="${2:-kata-artifacts}"
stability_dir="$(dirname "$(readlink -f "$0")")" stability_dir="$(dirname "$(readlink -f "$0")")"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2017-2018, 2020 Intel Corporation # Copyright (c) 2017-2023 Intel Corporation
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -42,7 +42,7 @@ MAX_CONTAINERS="${MAX_CONTAINERS:-110}"
KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}" KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"
check_vsock_active() { function check_vsock_active() {
vsock_configured=$($RUNTIME_PATH kata-env | awk '/UseVSock/ {print $3}') vsock_configured=$($RUNTIME_PATH kata-env | awk '/UseVSock/ {print $3}')
vsock_supported=$($RUNTIME_PATH kata-env | awk '/SupportVSock/ {print $3}') vsock_supported=$($RUNTIME_PATH kata-env | awk '/SupportVSock/ {print $3}')
if [ "$vsock_configured" == true ] && [ "$vsock_supported" == true ]; then if [ "$vsock_configured" == true ] && [ "$vsock_supported" == true ]; then
@ -52,20 +52,20 @@ check_vsock_active() {
fi fi
} }
count_containers() { function count_containers() {
sudo ctr c list -q | wc -l sudo ctr c list -q | wc -l
} }
check_all_running() { function check_all_running() {
local goterror=0 local goterror=0
echo "Checking ${how_many} containers have all relevant components" info "Checking ${how_many} containers have all relevant components"
# check what docker thinks # check what docker thinks
how_many_running=$(count_containers) how_many_running=$(count_containers)
if (( ${how_many_running} != ${how_many} )); then if (( ${how_many_running} != ${how_many} )); then
echo "Wrong number of containers running (${how_many_running} != ${how_many}) - stopping" info "Wrong number of containers running (${how_many_running} != ${how_many}) - stopping"
((goterror++)) ((goterror++))
fi fi
@ -76,7 +76,7 @@ check_all_running() {
how_many_shims=$(pgrep -a -f ${SHIM_PATH} | grep containerd.sock | wc -l) how_many_shims=$(pgrep -a -f ${SHIM_PATH} | grep containerd.sock | wc -l)
# one shim process per container... # one shim process per container...
if (( ${how_many_running} != ${how_many_shims} )); then if (( ${how_many_running} != ${how_many_shims} )); then
echo "Wrong number of shims running (${how_many_running} != ${how_many_shims}) - stopping" info "Wrong number of shims running (${how_many_running} != ${how_many_shims}) - stopping"
((goterror++)) ((goterror++))
fi fi
@ -84,7 +84,7 @@ check_all_running() {
if [[ "$KATA_HYPERVISOR" != "dragonball" ]]; then if [[ "$KATA_HYPERVISOR" != "dragonball" ]]; then
how_many_vms=$(pgrep -a $(basename ${HYPERVISOR_PATH} | cut -d '-' -f1) | wc -l) how_many_vms=$(pgrep -a $(basename ${HYPERVISOR_PATH} | cut -d '-' -f1) | wc -l)
if (( ${how_many_running} != ${how_many_vms} )); then if (( ${how_many_running} != ${how_many_vms} )); then
echo "Wrong number of $KATA_HYPERVISOR running (${how_many_running} != ${how_many_vms}) - stopping" info "Wrong number of $KATA_HYPERVISOR running (${how_many_running} != ${how_many_vms}) - stopping"
((goterror++)) ((goterror++))
fi fi
fi fi
@ -95,7 +95,7 @@ check_all_running() {
num_vc_pods=$(sudo ls -1 ${VC_POD_DIR} | wc -l) num_vc_pods=$(sudo ls -1 ${VC_POD_DIR} | wc -l)
if (( ${how_many_running} != ${num_vc_pods} )); then if (( ${how_many_running} != ${num_vc_pods} )); then
echo "Wrong number of pods in $VC_POD_DIR (${how_many_running} != ${num_vc_pods}) - stopping)" info "Wrong number of pods in $VC_POD_DIR (${how_many_running} != ${num_vc_pods}) - stopping)"
((goterror++)) ((goterror++))
fi fi
fi fi
@ -109,12 +109,12 @@ check_all_running() {
} }
# reported system 'available' memory # reported system 'available' memory
get_system_avail() { function get_system_avail() {
echo $(free -b | head -2 | tail -1 | awk '{print $7}') echo $(free -b | head -2 | tail -1 | awk '{print $7}')
} }
go() { function go() {
echo "Running..." info "Running..."
how_many=0 how_many=0
@ -129,32 +129,32 @@ go() {
done done
if (( ${how_many} >= ${MAX_CONTAINERS} )); then if (( ${how_many} >= ${MAX_CONTAINERS} )); then
echo "And we have hit the max ${how_many} containers" info "And we have hit the max ${how_many} containers"
return return
fi fi
how_much=$(get_system_avail) how_much=$(get_system_avail)
if (( ${how_much} < ${MEM_CUTOFF} )); then if (( ${how_much} < ${MEM_CUTOFF} )); then
echo "And we are out of memory on container ${how_many} (${how_much} < ${MEM_CUTOFF})" info "And we are out of memory on container ${how_many} (${how_much} < ${MEM_CUTOFF})"
return return
fi fi
} }
done done
} }
count_mounts() { function count_mounts() {
echo $(mount | wc -l) echo $(mount | wc -l)
} }
check_mounts() { function check_mounts() {
final_mount_count=$(count_mounts) final_mount_count=$(count_mounts)
if [[ $final_mount_count < $initial_mount_count ]]; then if [[ $final_mount_count < $initial_mount_count ]]; then
echo "Final mount count does not match initial count (${final_mount_count} != ${initial_mount_count})" info "Final mount count does not match initial count (${final_mount_count} != ${initial_mount_count})"
fi fi
} }
init() { function init() {
restart_containerd_service restart_containerd_service
extract_kata_env extract_kata_env
clean_env_ctr clean_env_ctr
@ -165,10 +165,10 @@ init() {
# Only check Kata items if we are using a Kata runtime # Only check Kata items if we are using a Kata runtime
if [[ "$RUNTIME" == "containerd-shim-kata-v2" ]]; then if [[ "$RUNTIME" == "containerd-shim-kata-v2" ]]; then
echo "Checking Kata runtime" info "Checking Kata runtime"
check_kata_components=1 check_kata_components=1
else else
echo "Not a Kata runtime, not checking for Kata components" info "Not a Kata runtime, not checking for Kata components"
check_kata_components=0 check_kata_components=0
fi fi
@ -183,10 +183,10 @@ init() {
fi fi
} }
spin() { function spin() {
local i local i
for ((i=1; i<= ITERATIONS; i++)); do { for ((i=1; i<= ITERATIONS; i++)); do {
echo "Start iteration $i of $ITERATIONS" info "Start iteration $i of $ITERATIONS"
#spin them up #spin them up
go go
#check we are in a sane state #check we are in a sane state