Skip to content

Commit

Permalink
add validation test for #2056
Browse files Browse the repository at this point in the history
  • Loading branch information
glimberg committed Jul 17, 2023
1 parent 6a872af commit 19d92e5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ echo -e "\nBytes of memory definitely lost: $DEFINITELY_LOST"
if [[ "$DEFINITELY_LOST" -gt 0 ]]; then
exit 1
fi

EXIT_TEST_FAILED=$(cat *test-results/*summary.json | jq .exit_test_failed)

if [[ "$EXIT_TEST_FAILED" -gt 0 ]]; then
exit 1
fi
29 changes: 28 additions & 1 deletion .github/workflows/validate-1m-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ZTO_VER=$(git describe --tags $(git rev-list --tags --max-count=1))
ZTO_COMMIT=$(git rev-parse HEAD)
ZTO_COMMIT_SHORT=$(git rev-parse --short HEAD)
TEST_DIR_PREFIX="$ZTO_VER-$ZTO_COMMIT_SHORT-test-results"
EXIT_TEST_FAILED=0

echo "Performing test on: $ZTO_VER-$ZTO_COMMIT_SHORT"
TEST_FILEPATH_PREFIX="$TEST_DIR_PREFIX/$ZTO_COMMIT_SHORT"
mkdir $TEST_DIR_PREFIX
Expand All @@ -18,6 +20,9 @@ mkdir $TEST_DIR_PREFIX
################################################################################
main() {
echo -e "\nRunning test for $RUN_LENGTH seconds"

check_exit_on_invalid_identity

NS1="ip netns exec ns1"
NS2="ip netns exec ns2"

Expand Down Expand Up @@ -390,7 +395,8 @@ main() {
"mean_latency_ping_netns": $POSSIBLY_LOST,
"mean_pdv_random": $POSSIBLY_LOST,
"mean_pdv_netns": $POSSIBLY_LOST,
"mean_perf_netns": $POSSIBLY_LOST
"mean_perf_netns": $POSSIBLY_LOST,
"exit_test_failed": $EXIT_TEST_FAILED
}
EOF
)
Expand Down Expand Up @@ -431,4 +437,25 @@ spam_cli() {
done
}

check_exit_on_invalid_identity() {
echo "Checking ZeroTier exits on invalid identity..."
ZT1="./zerotier-cli -p9999 -D$(pwd)/exit_test"
echo "asdfasdfasdfasdf" > $(pwd)/exit_test/identity.secret

echo "Launch ZeroTier with an invalid identity"
$ZT1 &
my_pid=$!

echo "Waiting 5 secons"
sleep 5

# check if process is running
kill -0 $my_pid
if [ $? -eq 0 ]; then
EXIT_TEST_FAILED=1
echo "Exit test FAILED: Process still running after being fed an invalid identity"
fi
echo "Exit test PASSED"
}

main "$@"

0 comments on commit 19d92e5

Please sign in to comment.