From b87ed274161db21c3589b3e8ea86f7abd99438ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 13 Jul 2023 12:37:29 +0200 Subject: [PATCH] tests: Move `ensure_yq` to common.bash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As this function will be used by different scripts, let's move it to a common place. Signed-off-by: Fabiano FidĂȘncio --- tests/common.bash | 10 ++++++++++ tests/integration/kubernetes/gha-run.sh | 9 +-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/common.bash b/tests/common.bash index 64474d0fb..486bb4909 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -7,6 +7,9 @@ # This file contains common functions that # are being used by our metrics and integration tests +this_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +export repo_root_dir="$(cd "${this_script_dir}/../" && pwd)" + # Kata tests directory used for storing various test-related artifacts. KATA_TESTS_BASEDIR="${KATA_TESTS_BASEDIR:-/var/log/kata-tests}" @@ -330,3 +333,10 @@ function check_containerd_config_for_kata() { overwrite_containerd_config fi } + +function ensure_yq() { + : "${GOPATH:=${GITHUB_WORKSPACE}}" + export GOPATH + export PATH="${GOPATH}/bin:${PATH}" + INSTALL_IN_GOPATH=true "${repo_root_dir}/ci/install_yq.sh" +} diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index b38288efc..1f594f484 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -9,7 +9,7 @@ set -o nounset set -o pipefail kubernetes_dir="$(dirname "$(readlink -f "$0")")" -repo_root_dir="$(cd "${kubernetes_dir}/../../../" && pwd)" +source "${kubernetes_dir}/../../common.bash" tools_dir="${repo_root_dir}/tools" function _print_cluster_name() { @@ -59,13 +59,6 @@ function get_cluster_credentials() { -n "$(_print_cluster_name)" } -function ensure_yq() { - : "${GOPATH:=${GITHUB_WORKSPACE}}" - export GOPATH - export PATH="${GOPATH}/bin:${PATH}" - INSTALL_IN_GOPATH=true "${repo_root_dir}/ci/install_yq.sh" -} - function run_tests() { platform="${1}" ensure_yq