From 87d41b3dfaf10792826da0a3429bc70d629c8a95 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Mon, 31 Jul 2023 16:50:16 +0000 Subject: [PATCH] metrics: Add FIO test to gha for kata metrics CI This PR adds FIO test to gha for kata metrics CI. Fixes #7502 Signed-off-by: Gabriela Cervantes --- tests/metrics/storage/fio-k8s/fio-test-ci.sh | 85 ++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 tests/metrics/storage/fio-k8s/fio-test-ci.sh diff --git a/tests/metrics/storage/fio-k8s/fio-test-ci.sh b/tests/metrics/storage/fio-k8s/fio-test-ci.sh new file mode 100755 index 000000000..3ae51bea4 --- /dev/null +++ b/tests/metrics/storage/fio-k8s/fio-test-ci.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# Copyright (c) 2022-2023 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +# General env +SCRIPT_PATH=$(dirname "$(readlink -f "$0")") +source "${SCRIPT_PATH}/../../lib/common.bash" +FIO_PATH="${GOPATH}/src/${TEST_REPO}/metrics/storage/fio-k8s" +TEST_NAME="${TEST_NAME:-fio}" + +function main() { + cmds=("bc" "jq") + check_cmds "${cmds[@]}" + check_processes + init_env + + export KUBECONFIG="$HOME/.kube/config" + + pushd "${FIO_PATH}" + echo "INFO: Running K8S FIO test" + make test-ci + popd + + test_result_file="${FIO_PATH}/cmd/fiotest/test-results/kata/randrw-sync.job/output.json" + + metrics_json_init + local read_io=$(cat $test_result_file | grep io_bytes | head -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + local read_bw=$(cat $test_result_file | grep bw_bytes | head -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + local read_90_percentile=$(cat $test_result_file | grep 90.000000 | head -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + local read_95_percentile=$(cat $test_result_file | grep 95.000000 | head -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + local write_io=$(cat $test_result_file | grep io_bytes | head -2 | tail -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + local write_bw=$(cat $test_result_file | grep bw_bytes | head -2 | tail -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + local write_90_percentile=$(cat $test_result_file | grep 90.000000 | head -2 | tail -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + local write_95_percentile=$(cat $test_result_file | grep 95.000000 | head -2 | tail -1 | sed 's/[[:blank:]]//g' | cut -f2 -d ':' | cut -f1 -d ',') + + metrics_json_start_array + local json="$(cat << EOF + { + "readio": { + "Result" : $read_io, + "Units" : "bytes" + }, + "readbw": { + "Result" : $read_bw, + "Units" : "bytes/sec" + }, + "read90percentile": { + "Result" : $read_90_percentile, + "Units" : "ns" + }, + "read95percentile": { + "Result" : $read_95_percentile, + "Units" : "ns" + }, + "writeio": { + "Result" : $write_io, + "Units" : "bytes" + }, + "writebw": { + "Result" : $write_bw, + "Units" : "bytes/sec" + }, + "write90percentile": { + "Result" : $write_90_percentile, + "Units" : "ns" + }, + "write95percentile": { + "Result" : $write_95_percentile, + "Units" : "ns" + } + } +EOF +)" + metrics_json_add_array_element "$json" + metrics_json_end_array "Results" + metrics_json_save + + check_processes +} + +main "$@"