-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update rmb-tester helper scripts (#186)
* fix rmb_tester helper script * adding more helper scripts * rmb-tester: Update redis-py version * update README.md * update .gitignore
- Loading branch information
1 parent
a426b6c
commit e0d3855
Showing
6 changed files
with
99 additions
and
3 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,7 @@ | ||
|
||
/venv/ | ||
|
||
rmb-peer.log | ||
|
||
dump.rdb | ||
|
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
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,14 @@ | ||
#!/usr/bin/env bash | ||
echo ">> creating and activating the virtual environment .." | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
echo ">> installing .." | ||
python3 -m pip install --upgrade pip | ||
pip install -r ./requirements.txt | ||
echo "deactivating the virtual environment .." | ||
deactivate | ||
echo ">> install complete!" | ||
echo ">> to activate the virtual environment use 'source venv/bin/activate'" | ||
echo ">> or use ./test-live-nodes.sh script" | ||
echo ">> example: MNEMONIC=[MNEMONIC] ./test-live-nodes.sh [dev,qa,test,main]" | ||
echo ">> example: MNEMONIC=[MNEMONIC] TIMEOUT=[SECONDS] RMB_BIN=[BINARY-PATH] ./test-live-nodes.sh [dev,qa,test,main]" |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
alive-progress==2.4.1 | ||
redis==4.3.1 | ||
redis==5.0.1 | ||
hiredis==2.0.0 |
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
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,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
case $1 in | ||
main|dev|qa|test ) # Ok | ||
;; | ||
*) | ||
# The wrong first argument. | ||
echo 'Expected "dev", "qa", "test", or "main" as second arg' >&2 | ||
exit 1 | ||
esac | ||
|
||
|
||
if [[ "$1" == "main" ]]; then | ||
SUBSTRATE_URL="wss://tfchain.grid.tf:443" | ||
RELAY_URL="wss://relay.grid.tf" | ||
else | ||
SUBSTRATE_URL="wss://tfchain.$1.grid.tf:443" | ||
RELAY_URL="wss://relay.$1.grid.tf" | ||
fi | ||
RMB_LOG_FILE="./rmb-peer.log" | ||
TIMEOUT="${TIMEOUT:-60}" | ||
RMB_BIN="${RMB_BIN:-../../target/x86_64-unknown-linux-musl/release/rmb-peer}" | ||
|
||
cleanup() { | ||
echo "stop all bash managed jobs" | ||
jlist=$(jobs -p) | ||
plist=$(ps --ppid $$ | awk '/[0-9]/{print $1}') | ||
|
||
kill ${jlist:-$plist} | ||
} | ||
|
||
trap cleanup SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM | ||
|
||
|
||
# start redis in backgroud and skip errors in case alreday running | ||
set +e | ||
echo "redis-server starting .." | ||
|
||
redis-server --port 6379 2>&1 > /dev/null& | ||
sleep 3 | ||
set -e | ||
|
||
# start rmb in background | ||
echo "rmb-peer starting .." | ||
$RMB_BIN -m "$MNEMONIC" --substrate "$SUBSTRATE_URL" --relay "$RELAY_URL" --redis "redis://localhost:6379" --debug &> $RMB_LOG_FILE & | ||
|
||
# wait till peer establish connection to a relay | ||
timeout --preserve-status 10 tail -f -n0 $RMB_LOG_FILE | grep -qe 'now connected' || (echo "rmb-peer taking too much time to start! check the log at $RMB_LOG_FILE for more info." && cleanup) | ||
|
||
# start rmb_tester | ||
source venv/bin/activate | ||
echo "rmb_tester starting .." | ||
python3 ./rmb_tester.py -d $(./scripts/twins.sh --likely-up $1) -c "rmb.version" -t $TIMEOUT -e $TIMEOUT --short | ||
deactivate | ||
|
||
cleanup |