Skip to content

Commit

Permalink
Add multibench job for one run-file json
Browse files Browse the repository at this point in the history
Add the multibench hook for 'multi' scenario and a helper
script to prepare the run-file json.

Update the single bench case to start using the prepare-run-file
helper functions.
  • Loading branch information
rafaelfolco committed Oct 2, 2023
1 parent 59ee8fd commit bb37ab3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .github/actions/integration-tests/prepare-run-file
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Helper script to prepare run-file json
# Usage:
# source ${SCRIPT_DIR}/prepare-run-file

function replace_value() {
# Replace a value in the run-file json
# Usage: replace_value remote_host ${remote_host} \
# '."endpoints"[0]."host" = $remote_host'
# ("host" key will be replaced with the value of $remote_host variable)
#
# --arg <variable> <value> is declaring an argument named <variable>,
# with a value of <value> in the jq environment
# The <query> is what specifies the location in the JSON
# (the first part) and then the value to set it to (the second part, after the =)

local json=$1; shift # json file to replace value
local variable=$1; shift # variable to be declared as variable=value in jq's env
local value=$1; shift # value to assign to the variable declaration in jq's env
local query=$1; shift # query to match json's key/val

if [ -z "$(command -v jq)" ]; then
echo "ERROR running jq to edit the run-file JSON."
exit 1
fi

jq --arg ${variable} "${value}" "${query}" ${json} > ${json}.tmp
if [ $? != 0 ]; then
echo "ERROR editing the run-file JSON."
exit 1
fi

# Update original run-file json
/bin/mv ${json}.tmp ${json}
}

26 changes: 19 additions & 7 deletions .github/actions/integration-tests/run-ci-stage1
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,19 @@ for userenv in ${CI_ACTIVE_USERENVS}; do
run_cmd "crucible run iperf,uperf --tags run:2${TAGS} --num-samples ${CI_SAMPLES} --test-order r --mv-params ${SCRIPT_DIR}/mv-params/iperf-2.json,${SCRIPT_DIR}/mv-params/uperf-2.json ${ENDPOINT_ARG}"
post_run_cmd
fi

# multibench all-in-one json test
RUN_FILE="${SCRIPT_DIR}/run-file/ci-${scenario}-run-file-${CI_ENDPOINT}-${userenv}.json"
if [ -f "${RUN_FILE}" ]; then
source ${SCRIPT_DIR}/prepare-run-file
replace_value userenv ${userenv} '."endpoints"[0]."userenv" = $userenv'
replace_value controller_ip ${CONTROLLER_IP} '."endpoints"[0]."controller-ip" = $controller_ip'
replace_value host ${CI_ENDPOINT_HOST} '."endpoints"[0]."host" = $host'
replace_value user ${CI_ENDPOINT_USER} '."endpoints"[0]."user" = $user'
run_cmd "crucible run --from-file ${RUN_FILE}"
post_run_cmd
fi

;;
cyclictest)
case "${CI_ENDPOINT}" in
Expand Down Expand Up @@ -436,14 +449,13 @@ for userenv in ${CI_ACTIVE_USERENVS}; do

# Only run all-in-one json test if the runfile exists for the endpoint
# e.g.: ci-oslat-run-file-k8s-alma8.json
RUN_FILE="${SCRIPT_DIR}/run-file/ci-oslat-run-file-${CI_ENDPOINT}-${userenv}.json"
RUN_FILE="${SCRIPT_DIR}/run-file/ci-${scenario}-run-file-${CI_ENDPOINT}-${userenv}.json"
if [ -f "${RUN_FILE}" ]; then
sed -i "s|CI_REPEAT_RUNS|${CI_REPEAT_RUNS}|g" ${RUN_FILE}
sed -i "s|USERENV|${userenv}|g" ${RUN_FILE}
sed -i "s|SCRIPT_DIR|${SCRIPT_DIR}|g" ${RUN_FILE}
sed -i "s|CONTROLLER_IP|${CONTROLLER_IP}|g" ${RUN_FILE}
sed -i "s|CI_ENDPOINT_HOST|${CI_ENDPOINT_HOST}|g" ${RUN_FILE}
sed -i "s|CI_ENDPOINT_USER|${CI_ENDPOINT_USER}|g" ${RUN_FILE}
source ${SCRIPT_DIR}/prepare-run-file
replace_value userenv ${userenv} '."endpoints"[0]."userenv" = $userenv'
replace_value controller_ip ${CONTROLLER_IP} '."endpoints"[0]."controller-ip" = $controller_ip'
replace_value host ${CI_ENDPOINT_HOST} '."endpoints"[0]."host" = $host'
replace_value user ${CI_ENDPOINT_USER} '."endpoints"[0]."user" = $user'
run_cmd "crucible run --from-file ${RUN_FILE}"
post_run_cmd
fi
Expand Down

0 comments on commit bb37ab3

Please sign in to comment.