Jenkins: add timeouts to testnet finalisation tests (#947)

* Jenkins: add timeouts to testnet finalisation tests

- add nicer child process management to "launch_local_testnet.sh"
- correct a comment in "start.sh"

* the Jenkins worker's version of "timeout" doesn't support "-v"
This commit is contained in:
Ștefan Talpalaru 2020-04-30 15:59:57 +02:00 committed by GitHub
parent cd939d4606
commit 784c5e3d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 9 deletions

4
Jenkinsfile vendored
View File

@ -31,8 +31,8 @@ def runStages() {
} }
if ("${NODE_NAME}" ==~ /linux.*/) { if ("${NODE_NAME}" ==~ /linux.*/) {
stage("testnet finalization") { stage("testnet finalization") {
sh "./scripts/launch_local_testnet.sh --testnet 0 --nodes 4 --log-level INFO --disable-htop -- --verify-finalization --stop-at-epoch=5" sh "timeout -k 20s 10m ./scripts/launch_local_testnet.sh --testnet 0 --nodes 4 --log-level INFO --disable-htop -- --verify-finalization --stop-at-epoch=5"
sh "./scripts/launch_local_testnet.sh --testnet 1 --nodes 4 --log-level INFO --disable-htop -- --verify-finalization --stop-at-epoch=5" sh "timeout -k 20s 40m ./scripts/launch_local_testnet.sh --testnet 1 --nodes 4 --log-level INFO --disable-htop -- --verify-finalization --stop-at-epoch=5"
} }
} }
} }

View File

@ -140,12 +140,15 @@ BOOTSTRAP_IP="127.0.0.1"
--bootstrap-port=${BOOTSTRAP_PORT} \ --bootstrap-port=${BOOTSTRAP_PORT} \
--genesis-offset=5 # Delay in seconds --genesis-offset=5 # Delay in seconds
# Kill child processes on Ctrl-C/SIGTERM/exit, passing the PID of this shell
# instance as the parent and the target process name as a pattern to the
# "pkill" command.
cleanup() { cleanup() {
killall beacon_node &>/dev/null || true pkill -P $$ beacon_node &>/dev/null || true
sleep 2 sleep 2
killall -9 beacon_node &>/dev/null || true pkill -9 -P $$ beacon_node &>/dev/null || true
} }
cleanup trap 'cleanup' SIGINT SIGTERM EXIT
PIDS="" PIDS=""
NODES_WITH_VALIDATORS=${NODES_WITH_VALIDATORS:-4} NODES_WITH_VALIDATORS=${NODES_WITH_VALIDATORS:-4}
@ -172,7 +175,7 @@ for NUM_NODE in $(seq 0 $(( ${NUM_NODES} - 1 ))); do
done done
fi fi
stdbuf -o0 build/beacon_node \ ./build/beacon_node \
--nat:extip:127.0.0.1 \ --nat:extip:127.0.0.1 \
--log-level="${LOG_LEVEL}" \ --log-level="${LOG_LEVEL}" \
--tcp-port=$(( ${BOOTSTRAP_PORT} + ${NUM_NODE} )) \ --tcp-port=$(( ${BOOTSTRAP_PORT} + ${NUM_NODE} )) \

View File

@ -189,9 +189,9 @@ echo Creating grafana dashboards...
--in="${SIM_ROOT}/beacon-chain-sim-node0-Grafana-dashboard.json" \ --in="${SIM_ROOT}/beacon-chain-sim-node0-Grafana-dashboard.json" \
--out="${SIM_ROOT}/beacon-chain-sim-all-nodes-Grafana-dashboard.json" --out="${SIM_ROOT}/beacon-chain-sim-all-nodes-Grafana-dashboard.json"
# Kill child processes on Ctrl-C by sending SIGTERM to the whole process group, # Kill child processes on Ctrl-C/SIGTERM/exit, passing the PID of this shell
# passing the negative PID of this shell instance to the "kill" command. # instance as the parent and the target process name as a pattern to the
# Trap and ignore SIGTERM, so we don't kill this process along with its children. # "pkill" command.
if [[ "$USE_MULTITAIL" == "no" && "$USE_TMUX" == "no" ]]; then if [[ "$USE_MULTITAIL" == "no" && "$USE_TMUX" == "no" ]]; then
trap 'pkill -P $$ beacon_node' SIGINT EXIT trap 'pkill -P $$ beacon_node' SIGINT EXIT
fi fi