Skip to content

Commit

Permalink
check ocp version and export CNF_TEST_IMAGE variable with appropriate…
Browse files Browse the repository at this point in the history
… cluster version (#584)

display message detecting ocp version and fix oc get command



Fix latency scripts to check ocp version and use appropriate cnf-tests image

Also fixing typo to use CNF_TESTS_IMAGE instead CNF_TEST_IMAGE



fixing check for CNF_TESTS_IMAGE env variable name

Signed-off-by: Niranjan M.R <mrniranjan@redhat.com>
Co-authored-by: Niranjan M.R <mrniranjan@redhat.com>
  • Loading branch information
mrniranjan and Niranjan M.R committed May 31, 2023
1 parent 94c21e1 commit 3d5cdf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hack/run-functests.sh
Expand Up @@ -2,6 +2,7 @@

GINKGO_SUITS=${GINKGO_SUITS:-"test/e2e/performanceprofile/functests"}
LATENCY_TEST_RUN=${LATENCY_TEST_RUN:-"false"}
OC_TOOL="${OC_TOOL:-oc}"

which ginkgo
if [ $? -ne 0 ]; then
Expand All @@ -21,6 +22,12 @@ if [ -n "${IMAGE_FORMAT}" ]; then
LATENCY_TEST_RUN="true"
fi

if [[ -z "${CNF_TESTS_IMAGE}" ]]; then

echo "autodetected cluster version: ${ocp_version}"
ocp_version=$(${OC_TOOL} get clusterversion -o jsonpath='{.items[].status.desired.version}{"\n"}' | awk -F "." '{print $1"."$2}')
export CNF_TESTS_IMAGE=cnf-tests:${ocp_version}
fi

echo "Running Functional Tests: ${GINKGO_SUITS}"
# -v: print out the text and location for each spec before running it and flush output to stdout in realtime
Expand Down
7 changes: 7 additions & 0 deletions hack/run-latency-testing.sh
@@ -1,6 +1,7 @@
#!/bin/bash

GINKGO_SUITS=${GINKGO_SUITS:-"./test/e2e/performanceprofile/functests/0_config ./test/e2e/performanceprofile/functests/5_latency_testing"}
OC_TOOL="${OC_TOOL:-oc}"

which ginkgo
if [ $? -ne 0 ]; then
Expand All @@ -15,6 +16,12 @@ if ! which tput &> /dev/null 2>&1 || [[ $(tput -T$TERM colors) -lt 8 ]]; then
NO_COLOR="-noColor"
fi

if [[ -z "${CNF_TESTS_IMAGE}" ]]; then

echo "autodetected cluster version: ${ocp_version}"
ocp_version=$(${OC_TOOL} get clusterversion -o jsonpath='{.items[].status.desired.version}{"\n"}' | awk -F "." '{print $1"."$2}')
export CNF_TESTS_IMAGE=cnf-tests:${ocp_version}
fi

echo "Running Functional Tests: ${GINKGO_SUITS}"
# -v: print out the text and location for each spec before running it and flush output to stdout in realtime
Expand Down

0 comments on commit 3d5cdf5

Please sign in to comment.