-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add manual integration test scripts
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 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 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Run three instances where instance 0 and instance 2 are mining but instance 1 is not. The nodes are connected like this: | ||
# (0) <-> (1) <-> (2) | ||
# So whenever a block is found by 0 or by 2, it is propagated through 1. | ||
|
||
if ! command -v cpulimit &> /dev/null | ||
then | ||
echo "cpulimit could not be found. Please install it." | ||
echo "For example, on unbuntu: sudo apt-get install cpulimit" | ||
# Add installation instructions for other Linux distributions here. | ||
exit | ||
fi | ||
|
||
set -e # Exit on first error. | ||
|
||
export RUST_LOG=debug; | ||
|
||
LOCAL_STATE_DIR=~/.local/share/neptune-integration-test-from-genesis | ||
|
||
EXTRA_ARGS="" | ||
|
||
# delete all local state first. | ||
rm -rf $LOCAL_STATE_DIR | ||
|
||
RUST_BACKTRACE=1 XDG_DATA_HOME=$LOCAL_STATE_DIR/0/ nice -n 18 -- cargo run -- --network regtest --peer-port 29790 --rpc-port 19790 --mine $EXTRA_ARGS 2>&1 | tee /tmp/integration_test_from_genesis-0.log | sed 's/.*neptune_core:\+\(.*\)/I0: \1/g' & | ||
pid[0]=$! | ||
sleep 5s; | ||
RUST_BACKTRACE=1 XDG_DATA_HOME=$LOCAL_STATE_DIR/1/ nice -n 18 -- cargo run -- --network regtest --peer-port 29791 --rpc-port 19791 --peers 127.0.0.1:29790 $EXTRA_ARGS 2>&1 | tee /tmp/integration_test_from_genesis-1.log | sed 's/.*neptune_core:\+\(.*\)/I1: \1/g' & | ||
pid[1]=$! | ||
sleep 5s; | ||
RUST_BACKTRACE=1 XDG_DATA_HOME=$LOCAL_STATE_DIR/2/ nice -n 18 -- cargo run -- --network regtest --peer-port 29792 --rpc-port 19792 --peers 127.0.0.1:29791 --mine --max-number-of-blocks-before-syncing 1000 $EXTRA_ARGS 2>&1 | tee /tmp/integration_test_from_genesis-2.log | sed 's/.*neptune_core:\+\(.*\)/I2: \1/g' & | ||
pid[2]=$! | ||
|
||
# Inspired by https://stackoverflow.com/a/52033580/2574407 | ||
trap 'kill -0 ${pid[0]} ${pid[1]} ${pid[2]}; exit 0' SIGINT | ||
wait |
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 @@ | ||
#!/usr/bin/env bash | ||
# | ||
CMD=./target/debug/neptune-cli | ||
|
||
$CMD --server-addr 127.0.0.1:19790 shutdown | ||
$CMD --server-addr 127.0.0.1:19791 shutdown | ||
$CMD --server-addr 127.0.0.1:19792 shutdown |