dncurrency/systest/rpc_stop.sh
Dimitrios Siganos 274c6714ca
A system test to exercise the rpc stop command (#4573)
Introduce a systest case for rpc stop command
2024-04-30 14:47:44 +01:00

22 lines
564 B
Bash
Executable file

#!/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