Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion test/scripts/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ echo "RUN_KMD_WITH_UNSAFE_SCRYPT = ${RUN_KMD_WITH_UNSAFE_SCRYPT}"

export BINDIR=${TEMPDIR}/bin
export DATADIR=${TEMPDIR}/data
export NETWORKDIR=${TEMPDIR}/net

function reset_dirs() {
rm -rf ${BINDIR}
rm -rf ${DATADIR}
rm -rf ${NETWORKDIR}
mkdir -p ${BINDIR}
mkdir -p ${DATADIR}
mkdir -p ${NETWORKDIR}
}

# $1 - Message
Expand Down Expand Up @@ -155,9 +158,16 @@ if [ -z "$E2E_TEST_FILTER" ] || [ "$E2E_TEST_FILTER" == "SCRIPTS" ]; then
exit
fi

./timeout 200 ./e2e_basic_start_stop.sh
goal network create \
-r $NETWORKDIR \
-n tbd \
-t ../testdata/nettemplates/TwoNodes50EachFuture.json

./timeout 200 ./e2e_basic_start_stop.sh $NETWORKDIR
duration "e2e_basic_start_stop.sh"

goal network delete -r $NETWORKDIR

KEEP_TEMPS_CMD_STR=""

# If the platform is arm64, we want to pass "--keep-temps" into e2e_client_runner.py
Expand Down
63 changes: 34 additions & 29 deletions test/scripts/e2e_basic_start_stop.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
#!/usr/bin/env bash

set -euf -o pipefail

echo "######################################################################"
echo " e2e_basic_start_stop"
echo "######################################################################"
set -e

# Suppress telemetry reporting for tests
export ALGOTEST=1
if [ "$#" -eq 0 ]; then
echo "Usage: e2e_basic_start_stop.sh <DATA_DIR>"
exit 1
fi

DATA_DIR="$1"
RUNNING_COUNT=0
# Suppress telemetry reporting for tests
export ALGOTEST=1

function update_running_count() {
PIDS=($(pgrep -u $(whoami) -x algod)) || true
PIDS=($(pgrep -u "$(whoami)" -x algod)) || true
RUNNING_COUNT=${#PIDS[@]}
}

function verify_at_least_one_running() {
# Starting up can take some time, so wait at least 2 seconds
for TRIES in 1 2 3 4 5; do
for _ in 1 2 3 4 5; do
update_running_count
if [ ${RUNNING_COUNT} -ge 1 ]; then
if [ "$RUNNING_COUNT" -ge 1 ]; then
return 0
fi
sleep .4
Expand All @@ -28,34 +35,32 @@ function verify_at_least_one_running() {
}

function verify_none_running() {
local datadir=$1

# Shutting down can take some time, so wait at least 5 seconds
for TRIES in 1 2 3 4 5; do
for _ in 1 2 3 4 5; do
update_running_count
if [ ${RUNNING_COUNT} -eq 0 ]; then
if [ "$RUNNING_COUNT" -eq 0 ]; then
return 0
fi
sleep 1.4
done
echo "algod not expected to be running but it is"
if [ -n "$datadir" ]; then
if [ -n "$DATA_DIR" ]; then
echo "last 20 lines of node.log:"
tail -20 "$datadir/node.log"
tail -20 "$DATA_DIR/node.log"
echo "================================"
echo "stdout and stdin:"
cat "$datadir/algod-out.log"
cat "$DATA_DIR/algod-out.log"
echo "================================"
cat "$datadir/algod-err.log"
cat "$DATA_DIR/algod-err.log"
fi
exit 1
}

function verify_one_running() {
# Starting up can take some time, so retry up to 2 seconds
for TRIES in 1 2 3 4 5; do
for _ in 1 2 3 4 5; do
update_running_count
if [ ${RUNNING_COUNT} -eq 1 ]; then
if [ "$RUNNING_COUNT" -eq 1 ]; then
return 0
fi
sleep .4
Expand All @@ -70,33 +75,33 @@ verify_none_running
#----------------------
# Test that we can start & stop a generic node with no overrides
echo Verifying a generic node will start using goal
goal node start -d ${DATADIR}
goal node start -d "$DATA_DIR"
verify_at_least_one_running

echo Verifying we can stop it using goal
goal node stop -d ${DATADIR}
verify_none_running ${DATADIR}
goal node stop -d "$DATA_DIR"
verify_none_running

#----------------------
# Test that we can start a generic node straight with no overrides
echo Verifying a generic node will start directly
algod -d ${DATADIR} &
algod -d "$DATA_DIR" &
verify_at_least_one_running
pkill -u $(whoami) -x algod || true
verify_none_running ${DATADIR}
pkill -u "$(whoami)" -x algod || true
verify_none_running

#----------------------
# Test that we can start a generic node against the datadir
# but that we cannot start a second one against same datadir
echo Verifying that the datadir algod lock works correctly
algod -d ${DATADIR} &
# Test that we can start a generic node against the data dir
# but that we cannot start a second one against same data dir
echo Verifying that the data dir algod lock works correctly
algod -d "$DATA_DIR" &
verify_at_least_one_running
algod -d ${DATADIR} &
algod -d "$DATA_DIR" &
verify_at_least_one_running # one should still be running
verify_one_running # in fact, exactly one should still be running
# clean up
pkill -u $(whoami) -x algod || true
verify_none_running ${DATADIR}
pkill -u "$(whoami)" -x algod || true
verify_none_running

echo "----------------------------------------------------------------------"
echo " DONE: e2e_basic_start_stop"
Expand Down
6 changes: 6 additions & 0 deletions tools/network/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package network
import (
"context"
"net"
"os"
"strings"
"testing"
"time"

Expand All @@ -29,6 +31,10 @@ import (
func TestResolver(t *testing.T) {
partitiontest.PartitionTest(t)

if strings.ToUpper(os.Getenv("CIRCLECI")) == "TRUE" {
t.Skip("Disabled on CircleCI while investigating Cloudflare DNS resolution issue")
}

// start with a resolver that has no specific DNS address defined.
// we want to make sure that it will go to the default DNS server ( 8.8.8.8 )
resolver := Resolver{}
Expand Down