mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-09 20:12:50 +00:00
Improve validation test (#2013)
This commit is contained in:
parent
17f6b3a10b
commit
524363dcf7
113
.github/workflows/validate-1m-linux.sh
vendored
113
.github/workflows/validate-1m-linux.sh
vendored
@ -3,7 +3,7 @@
|
||||
# This test script joins Earth and pokes some stuff
|
||||
|
||||
TEST_NETWORK=8056c2e21c000001
|
||||
RUN_LENGTH=10
|
||||
RUN_LENGTH=60
|
||||
TEST_FINISHED=false
|
||||
ZTO_VER=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
ZTO_COMMIT=$(git rev-parse HEAD)
|
||||
@ -16,15 +16,16 @@ mkdir $TEST_DIR_PREFIX
|
||||
################################################################################
|
||||
# Multi-node connectivity and performance test #
|
||||
################################################################################
|
||||
|
||||
main() {
|
||||
echo -e "\nRunning test for $RUN_LENGTH seconds"
|
||||
NS1="ip netns exec ns1"
|
||||
NS2="ip netns exec ns2"
|
||||
|
||||
ZT1="$NS1 ./zerotier-cli -D$(pwd)/node1"
|
||||
ZT1="$NS1 ./zerotier-cli -p9996 -D$(pwd)/node1"
|
||||
# Specify custom port on one node to ensure that feature works
|
||||
ZT2="$NS2 ./zerotier-cli -p9997 -D$(pwd)/node2"
|
||||
|
||||
echo -e "Setting up network namespaces..."
|
||||
echo -e "\nSetting up network namespaces..."
|
||||
echo "Setting up ns1"
|
||||
|
||||
ip netns add ns1
|
||||
@ -93,7 +94,7 @@ FILENAME_MEMORY_LOG="$TEST_FILEPATH_PREFIX-memory.log"
|
||||
|
||||
echo -e "\nStarting a ZeroTier instance in each namespace..."
|
||||
|
||||
time_test_start=`date +%s`
|
||||
time_test_start=$(date +%s)
|
||||
|
||||
# Spam the CLI as ZeroTier is starting
|
||||
spam_cli 100
|
||||
@ -104,7 +105,7 @@ $NS1 sudo valgrind --demangle=yes --exit-on-first-error=yes \
|
||||
--xml=yes \
|
||||
--xml-file=$FILENAME_MEMORY_LOG \
|
||||
--leak-check=full \
|
||||
./zerotier-one node1 -U >>node_1.log 2>&1 &
|
||||
./zerotier-one node1 -p9996 -U >>node_1.log 2>&1 &
|
||||
|
||||
# Second instance, not run in memory profiler
|
||||
$NS2 sudo ./zerotier-one node2 -U -p9997 >>node_2.log 2>&1 &
|
||||
@ -113,62 +114,25 @@ $NS2 sudo ./zerotier-one node2 -U -p9997 >>node_2.log 2>&1 &
|
||||
# Online Check #
|
||||
################################################################################
|
||||
|
||||
spam_cli()
|
||||
{
|
||||
echo "Spamming CLI..."
|
||||
# Rapidly spam the CLI with joins/leaves
|
||||
|
||||
MAX_TRIES="${$1:-10}"
|
||||
|
||||
for ((s=0; s<=MAX_TRIES; s++))
|
||||
do
|
||||
$ZT1 status
|
||||
$ZT2 status
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
SPAM_TRIES=128
|
||||
|
||||
for ((s=0; s<=SPAM_TRIES; s++))
|
||||
do
|
||||
$ZT1 join $TEST_NETWORK
|
||||
done
|
||||
|
||||
for ((s=0; s<=SPAM_TRIES; s++))
|
||||
do
|
||||
$ZT1 leave $TEST_NETWORK
|
||||
done
|
||||
|
||||
for ((s=0; s<=SPAM_TRIES; s++))
|
||||
do
|
||||
$ZT1 leave $TEST_NETWORK
|
||||
$ZT1 join $TEST_NETWORK
|
||||
done
|
||||
}
|
||||
|
||||
echo "Waiting for ZeroTier to come online before attempting test..."
|
||||
MAX_WAIT_SECS="${MAX_WAIT_SECS:-120}"
|
||||
node1_online=false
|
||||
node2_online=false
|
||||
both_instances_online=false
|
||||
time_zt_node1_start=`date +%s`
|
||||
time_zt_node2_start=`date +%s`
|
||||
time_zt_node1_start=$(date +%s)
|
||||
time_zt_node2_start=$(date +%s)
|
||||
|
||||
for ((s=0; s<=MAX_WAIT_SECS; s++))
|
||||
do
|
||||
for ((s = 0; s <= MAX_WAIT_SECS; s++)); do
|
||||
node1_online="$($ZT1 -j info | jq '.online' 2>/dev/null)"
|
||||
node2_online="$($ZT2 -j info | jq '.online' 2>/dev/null)"
|
||||
echo "Checking for online status: try #$s, node1:$node1_online, node2:$node2_online"
|
||||
if [[ "$node1_online" == "true" ]]
|
||||
then
|
||||
time_zt_node1_online=`date +%s`
|
||||
if [[ "$node1_online" == "true" ]]; then
|
||||
time_zt_node1_online=$(date +%s)
|
||||
fi
|
||||
if [[ "$node2_online" == "true" ]]
|
||||
then
|
||||
time_zt_node2_online=`date +%s`
|
||||
if [[ "$node2_online" == "true" ]]; then
|
||||
time_zt_node2_online=$(date +%s)
|
||||
fi
|
||||
if [[ "$node2_online" == "true" && "$node1_online" == "true" ]]
|
||||
then
|
||||
if [[ "$node2_online" == "true" && "$node1_online" == "true" ]]; then
|
||||
both_instances_online=true
|
||||
break
|
||||
fi
|
||||
@ -195,8 +159,7 @@ $ZT1 status
|
||||
echo -e "\n\nNode 2:"
|
||||
$ZT2 status
|
||||
|
||||
if [[ "$both_instances_online" != "true" ]]
|
||||
then
|
||||
if [[ "$both_instances_online" != "true" ]]; then
|
||||
echo "One or more instances of ZeroTier failed to come online. Aborting test."
|
||||
exit 1
|
||||
fi
|
||||
@ -226,9 +189,9 @@ $NS2 ping -c 16 $node1_ip4 > $PING21_FILENAME
|
||||
ping_loss_percent_1_to_2="${ping_loss_percent_1_to_2:-100.0}"
|
||||
ping_loss_percent_2_to_1="${ping_loss_percent_2_to_1:-100.0}"
|
||||
|
||||
ping_loss_percent_1_to_2=$(cat $PING12_FILENAME | \
|
||||
ping_loss_percent_1_to_2=$(cat $PING12_FILENAME |
|
||||
grep "packet loss" | awk '{print $6}' | sed 's/%//')
|
||||
ping_loss_percent_2_to_1=$(cat $PING21_FILENAME | \
|
||||
ping_loss_percent_2_to_1=$(cat $PING21_FILENAME |
|
||||
grep "packet loss" | awk '{print $6}' | sed 's/%//')
|
||||
|
||||
# Normalize loss value
|
||||
@ -341,7 +304,7 @@ echo -e "\nStopping memory check..."
|
||||
sudo pkill -15 -f valgrind
|
||||
sleep 10
|
||||
|
||||
time_test_end=`date +%s`
|
||||
time_test_end=$(date +%s)
|
||||
|
||||
################################################################################
|
||||
# Rename ZeroTier stdout/stderr logs #
|
||||
@ -403,7 +366,8 @@ time_length_zt_node2_online=$((time_zt_node2_online-time_zt_start))
|
||||
#time_length_zt_leave=$((time_zt_leave_end-time_zt_leave_start))
|
||||
#time_length_zt_can_still_ping=$((time_zt_can_still_ping-time_zt_leave_start))
|
||||
|
||||
summary=$(cat <<EOF
|
||||
summary=$(
|
||||
cat <<EOF
|
||||
{
|
||||
"version":"$ZTO_VER",
|
||||
"commit":"$ZTO_COMMIT",
|
||||
@ -433,5 +397,38 @@ EOF
|
||||
|
||||
echo $summary >$FILENAME_SUMMARY
|
||||
cat $FILENAME_SUMMARY
|
||||
}
|
||||
|
||||
"$@"
|
||||
################################################################################
|
||||
# CLI Check #
|
||||
################################################################################
|
||||
|
||||
spam_cli() {
|
||||
echo "Spamming CLI..."
|
||||
# Rapidly spam the CLI with joins/leaves
|
||||
|
||||
MAX_TRIES="${1:-10}"
|
||||
|
||||
for ((s = 0; s <= MAX_TRIES; s++)); do
|
||||
$ZT1 status
|
||||
$ZT2 status
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
SPAM_TRIES=128
|
||||
|
||||
for ((s = 0; s <= SPAM_TRIES; s++)); do
|
||||
$ZT1 join $TEST_NETWORK
|
||||
done
|
||||
|
||||
for ((s = 0; s <= SPAM_TRIES; s++)); do
|
||||
$ZT1 leave $TEST_NETWORK
|
||||
done
|
||||
|
||||
for ((s = 0; s <= SPAM_TRIES; s++)); do
|
||||
$ZT1 leave $TEST_NETWORK
|
||||
$ZT1 join $TEST_NETWORK
|
||||
done
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
Loading…
x
Reference in New Issue
Block a user