Skip to content
Permalink
Browse files
script: add options to cassandra-harry script
This patch added options to wrap script, it supported to assign test
duraton from cmdline.

Signed-off-by: Amos Kong <amos@scylladb.com>
  • Loading branch information
amoskong authored and ifesdjeen committed Nov 15, 2021
1 parent 0229696 commit 26bb6696ba1b18ff5c062d780a9360e750691052
Showing 2 changed files with 49 additions and 1 deletion.
@@ -4,6 +4,54 @@ if [ "x$HARRY_HOME" == 'x' ]; then
HARRY_HOME=~/cassandra-harry
fi

print_usage() {
cat <<EOF
Usage: cassandra-harry [options]
Options:
-node ip address node's ip
-run-time number run time, unit: hours
-run-time-unit unit unit of run time, HOURS, MINUTES
-help this helpful message
EOF
exit 1
}

while [ $# -gt 0 ]; do
case "$1" in
"-node")
node="$2"
shift 2
;;
"-run-time")
run_time="$2"
shift 2
;;
"-run-time-unit")
run_time_unit="$2"
shift 2
;;
"-help")
shift 1
print_usage
;;
*)
print_usage
;;
esac
done


if [[ ! -z $node ]]; then
sed -i -e "s/contact_points:.*/contact_points: $node/g" $HARRY_HOME/conf/external.yaml
fi
if [[ ! -z $run_time ]]; then
sed -i -e "s/run_time:.*/run_time: $run_time/g" $HARRY_HOME/conf/external.yaml
fi
if [[ ! -z $run_time_unit ]]; then
sed -i -e "s/run_time_unit:.*/run_time_unit: \"$run_time_unit\"/g" $HARRY_HOME/conf/external.yaml
fi

java -Dlogback.configurationFile=$HARRY_HOME/test/conf/logback-dtest.xml \
-jar $HARRY_HOME/harry-integration-external/target/harry-integration-external-0.0.1-SNAPSHOT.jar \
$HARRY_HOME/conf/external.yaml
@@ -11,5 +11,5 @@ sudo ln -s `realpath scripts/cassandra-harry` /usr/bin/cassandra-harry
### Execute

```
HARRY_HOME=~/cassandra-harry cassandra-harry
HARRY_HOME=~/cassandra-harry cassandra-harry -run-time 2 -run-time-unit HOURS
```

0 comments on commit 26bb669

Please sign in to comment.