From 25e0e2fb35cfa76354d5279699dc867fa9e2c62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bombo?= Date: Wed, 10 Jul 2024 17:19:08 +0000 Subject: [PATCH] ci: fix run-nydus tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GH-9973 introduced: * New function get_kata_memory_and_vcpus() in tests/metrics/lib/common.bash. * A call to get_kata_memory_and_vcpus() from extract_kata_env(), which is defined in tests/common.bash. Because the nydus test only sources tests/common.bash, it can't find get_kata_memory_and_vcpus() and errors out. We fix this by moving the get_kata_memory_and_vcpus() call from tests/common.bash to tests/metrics/lib/json.bash so that it doesn't impact the nydus test. Signed-off-by: Aurélien Bombo --- tests/common.bash | 5 ----- tests/metrics/lib/json.bash | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/common.bash b/tests/common.bash index cffec13045..046ae694e1 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -176,11 +176,6 @@ function extract_kata_env() { RUNTIME_PATH="$(echo "${kata_env}" | jq -r ${runtime_path})" SHARED_FS="$(echo "${kata_env}" | jq -r ${shared_fs})" - # get_kata_memory_and_vcpus() function measures the memory and the number of vcpus - # from a kata container, and saves these values ​​in the variables: - # 'MEASURED_CONTAINER_NUM_VCPUS' and 'MEASURED_CONTAINER_TOTAL_MEM' - get_kata_memory_and_vcpus - # get the requested memory and num of vcpus from the kata config file. config_content="$(cat ${RUNTIME_CONFIG_PATH} | grep -vE "^#")" REQ_MEMORY="$(echo "${config_content}" | grep -i default_memory | cut -d "=" -f2 | awk '{print $1}')" diff --git a/tests/metrics/lib/json.bash b/tests/metrics/lib/json.bash index e2705cfba7..a1033c7723 100755 --- a/tests/metrics/lib/json.bash +++ b/tests/metrics/lib/json.bash @@ -43,6 +43,11 @@ function metrics_json_init() { despaced_name="$(echo ${TEST_NAME} | sed 's/[ \/]/-/g')" json_filename="${RESULT_DIR}/${despaced_name}.json" + # get_kata_memory_and_vcpus() function measures the memory and the number of vcpus + # from a kata container, and saves these values ​​in the variables: + # 'MEASURED_CONTAINER_NUM_VCPUS' and 'MEASURED_CONTAINER_TOTAL_MEM' + get_kata_memory_and_vcpus + local json="$(cat << EOF "@timestamp" : $(timestamp_ms) EOF