forked from nanocurrency/nano-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A system test to exercise the rpc stop command (nanocurrency#4573)
Introduce a systest case for rpc stop command
- Loading branch information
Showing
2 changed files
with
23 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
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,22 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
DATADIR=$(mktemp -d) | ||
|
||
# Start the node in daemon mode in the background | ||
$NANO_NODE_EXE --daemon --network dev --data_path $DATADIR --config rpc.enable=true --rpcconfig enable_control=true & | ||
NODE_PID=$! | ||
|
||
# Allow some time for the node to start up completely | ||
sleep 10 | ||
|
||
# Send the stop rpc command | ||
curl -g -d '{ "action": "stop" }' '[::1]:45000' | ||
|
||
# Check if the process has stopped using a timeout to avoid infinite waiting | ||
if wait $NODE_PID; then | ||
echo "Node stopped successfully" | ||
else | ||
echo "Node did not stop as expected" | ||
exit 1 | ||
fi |