Jenkins: run local testnet test on macOS (#1391)
This commit is contained in:
parent
1220cc05ad
commit
fa9f35e148
|
@ -35,15 +35,13 @@ def runStages() {
|
||||||
stage("Test suite") {
|
stage("Test suite") {
|
||||||
sh "make -j${env.NPROC} DISABLE_TEST_FIXTURES_SCRIPT=1 test"
|
sh "make -j${env.NPROC} DISABLE_TEST_FIXTURES_SCRIPT=1 test"
|
||||||
}
|
}
|
||||||
if ("${NODE_NAME}" ==~ /linux.*/) {
|
stage("testnet finalization") {
|
||||||
stage("testnet finalization") {
|
// EXECUTOR_NUMBER will be 0 or 1, since we have 2 executors per Jenkins node
|
||||||
// EXECUTOR_NUMBER will be 0 or 1, since we have 2 executors per Jenkins node
|
sh """#!/bin/bash
|
||||||
sh """#!/bin/bash
|
set -e
|
||||||
set -e
|
./scripts/launch_local_testnet.sh --testnet 0 --nodes 4 --log-level INFO --disable-htop --data-dir local_testnet0_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) -- --verify-finalization --stop-at-epoch=5
|
||||||
timeout -k 20s 10m ./scripts/launch_local_testnet.sh --testnet 0 --nodes 4 --log-level INFO --disable-htop --data-dir local_testnet0_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) -- --verify-finalization --stop-at-epoch=5
|
./scripts/launch_local_testnet.sh --testnet 1 --nodes 4 --log-level INFO --disable-htop --data-dir local_testnet1_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) -- --verify-finalization --stop-at-epoch=5
|
||||||
timeout -k 20s 40m ./scripts/launch_local_testnet.sh --testnet 1 --nodes 4 --log-level INFO --disable-htop --data-dir local_testnet1_data --base-port \$(( 9000 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \$(( 8008 + EXECUTOR_NUMBER * 100 )) -- --verify-finalization --stop-at-epoch=5
|
"""
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -53,14 +51,12 @@ def runStages() {
|
||||||
throw e
|
throw e
|
||||||
} finally {
|
} finally {
|
||||||
// archive testnet logs
|
// archive testnet logs
|
||||||
if ("${NODE_NAME}" ==~ /linux.*/) {
|
sh """#!/bin/bash
|
||||||
sh """#!/bin/bash
|
for D in local_testnet0_data local_testnet1_data; do
|
||||||
for D in local_testnet0_data local_testnet1_data; do
|
[[ -d "\$D" ]] && tar cjf "\${D}-\${NODE_NAME}.tar.bz2" "\${D}"/*.txt || true
|
||||||
[[ -d "\$D" ]] && tar cjf "\${D}.tar.bz2" "\${D}"/*.txt || true
|
done
|
||||||
done
|
"""
|
||||||
"""
|
archiveArtifacts("*.tar.bz2")
|
||||||
archiveArtifacts("*.tar.bz2")
|
|
||||||
}
|
|
||||||
// clean the workspace
|
// clean the workspace
|
||||||
cleanWs(disableDeferredWipeout: true, deleteDirs: true)
|
cleanWs(disableDeferredWipeout: true, deleteDirs: true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,15 @@ cd "$(dirname "${BASH_SOURCE[0]}")"/..
|
||||||
####################
|
####################
|
||||||
# argument parsing #
|
# argument parsing #
|
||||||
####################
|
####################
|
||||||
! getopt --test > /dev/null
|
|
||||||
|
GETOPT_BINARY="getopt"
|
||||||
|
if uname | grep -qi darwin; then
|
||||||
|
# macOS
|
||||||
|
GETOPT_BINARY="/usr/local/opt/gnu-getopt/bin/getopt"
|
||||||
|
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
! ${GETOPT_BINARY} --test > /dev/null
|
||||||
if [ ${PIPESTATUS[0]} != 4 ]; then
|
if [ ${PIPESTATUS[0]} != 4 ]; then
|
||||||
echo '`getopt --test` failed in this environment.'
|
echo '`getopt --test` failed in this environment.'
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -55,7 +63,7 @@ CI run: $(basename $0) --disable-htop -- --verify-finalization --stop-at-epoch=5
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
! PARSED=$(getopt --options=${OPTS} --longoptions=${LONGOPTS} --name "$0" -- "$@")
|
! PARSED=$(${GETOPT_BINARY} --options=${OPTS} --longoptions=${LONGOPTS} --name "$0" -- "$@")
|
||||||
if [ ${PIPESTATUS[0]} != 0 ]; then
|
if [ ${PIPESTATUS[0]} != 0 ]; then
|
||||||
# getopt has complained about wrong arguments to stdout
|
# getopt has complained about wrong arguments to stdout
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -279,7 +287,7 @@ for NUM_NODE in $(seq 0 $(( NUM_NODES - 1 ))); do
|
||||||
|
|
||||||
if [[ $NUM_NODE -lt $NODES_WITH_VALIDATORS ]]; then
|
if [[ $NUM_NODE -lt $NODES_WITH_VALIDATORS ]]; then
|
||||||
for VALIDATOR in $(ls ${VALIDATORS_DIR} | tail -n +$(( $USER_VALIDATORS + ($VALIDATORS_PER_NODE * $NUM_NODE) + 1 )) | head -n $VALIDATORS_PER_NODE); do
|
for VALIDATOR in $(ls ${VALIDATORS_DIR} | tail -n +$(( $USER_VALIDATORS + ($VALIDATORS_PER_NODE * $NUM_NODE) + 1 )) | head -n $VALIDATORS_PER_NODE); do
|
||||||
cp -ar "${VALIDATORS_DIR}/$VALIDATOR" "${NODE_DATA_DIR}/validators/"
|
cp -a "${VALIDATORS_DIR}/$VALIDATOR" "${NODE_DATA_DIR}/validators/"
|
||||||
cp -a "${SECRETS_DIR}/${VALIDATOR}" "${NODE_DATA_DIR}/secrets/"
|
cp -a "${SECRETS_DIR}/${VALIDATOR}" "${NODE_DATA_DIR}/secrets/"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -310,7 +318,7 @@ done
|
||||||
|
|
||||||
# give the regular nodes time to crash
|
# give the regular nodes time to crash
|
||||||
sleep 5
|
sleep 5
|
||||||
BG_JOBS="$(jobs | wc -l)"
|
BG_JOBS="$(jobs | wc -l | tr -d ' ')"
|
||||||
if [[ "$BG_JOBS" != "$NUM_NODES" ]]; then
|
if [[ "$BG_JOBS" != "$NUM_NODES" ]]; then
|
||||||
echo "$((NUM_NODES - BG_JOBS)) beacon_node instance(s) exited early. Aborting."
|
echo "$((NUM_NODES - BG_JOBS)) beacon_node instance(s) exited early. Aborting."
|
||||||
dump_logs
|
dump_logs
|
||||||
|
|
|
@ -12,7 +12,15 @@ set -e
|
||||||
####################
|
####################
|
||||||
# argument parsing #
|
# argument parsing #
|
||||||
####################
|
####################
|
||||||
! getopt --test > /dev/null
|
|
||||||
|
GETOPT_BINARY="getopt"
|
||||||
|
if uname | grep -qi darwin; then
|
||||||
|
# macOS
|
||||||
|
GETOPT_BINARY="/usr/local/opt/gnu-getopt/bin/getopt"
|
||||||
|
[[ -f "$GETOPT_BINARY" ]] || { echo "GNU getopt not installed. Please run 'brew install gnu-getopt'. Aborting."; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
! ${GETOPT_BINARY} --test > /dev/null
|
||||||
if [ ${PIPESTATUS[0]} != 4 ]; then
|
if [ ${PIPESTATUS[0]} != 4 ]; then
|
||||||
echo '`getopt --test` failed in this environment.'
|
echo '`getopt --test` failed in this environment.'
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -37,7 +45,7 @@ Usage: $(basename $0) --nodes ${NUM_NODES} --base-metrics-port ${BASE_METRICS_PO
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
! PARSED=$(getopt --options=${OPTS} --longoptions=${LONGOPTS} --name "$0" -- "$@")
|
! PARSED=$(${GETOPT_BINARY} --options=${OPTS} --longoptions=${LONGOPTS} --name "$0" -- "$@")
|
||||||
if [ ${PIPESTATUS[0]} != 0 ]; then
|
if [ ${PIPESTATUS[0]} != 0 ]; then
|
||||||
# getopt has complained about wrong arguments to stdout
|
# getopt has complained about wrong arguments to stdout
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -34,7 +34,7 @@ if [[ $NODE_ID -lt $TOTAL_NODES ]]; then
|
||||||
|
|
||||||
pushd "$VALIDATORS_DIR" >/dev/null
|
pushd "$VALIDATORS_DIR" >/dev/null
|
||||||
for VALIDATOR in $(ls | tail -n +$(( $VALIDATOR_OFFSET + ($VALIDATORS_PER_NODE * $NODE_ID) + 1 )) | head -n $VALIDATORS_PER_NODE); do
|
for VALIDATOR in $(ls | tail -n +$(( $VALIDATOR_OFFSET + ($VALIDATORS_PER_NODE * $NODE_ID) + 1 )) | head -n $VALIDATORS_PER_NODE); do
|
||||||
cp -ar "$VALIDATOR" "$NODE_VALIDATORS_DIR"
|
cp -a "$VALIDATOR" "$NODE_VALIDATORS_DIR"
|
||||||
cp -a "$SECRETS_DIR/$VALIDATOR" "$NODE_SECRETS_DIR"
|
cp -a "$SECRETS_DIR/$VALIDATOR" "$NODE_SECRETS_DIR"
|
||||||
done
|
done
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
Loading…
Reference in New Issue