-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multibench job for one run-file json
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
1 parent
59ee8fd
commit bb37ab3
Showing
2 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters