mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-18 17:00:17 +00:00
(fixed) nwid detection in test script
This commit is contained in:
parent
5c5943a00c
commit
2196d982c3
@ -8,8 +8,8 @@ test_namefile=$(ls *.name)
|
||||
test_name="${test_namefile%.*}" # test network id
|
||||
nwconf=$(ls *.conf) # blank test network config file
|
||||
nwid="${nwconf%.*}" # test network id
|
||||
netcon_wait_time=25 # wait for test container to come online
|
||||
app_timeout_time=15 # app-specific timeout
|
||||
netcon_wait_time=35 # wait for test container to come online
|
||||
app_timeout_time=25 # app-specific timeout
|
||||
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
||||
file_base="$test_name".txt # test result output file
|
||||
fail=FAIL. # appended to result file in event of failure
|
||||
|
@ -16,7 +16,6 @@ bigfile_name=bigfile
|
||||
bigfile_size=10M # size of file we want to use for the test
|
||||
tx_md5sumfile="$file_path"tx_"$bigfile_name"_md5sum"$tmp_ext"
|
||||
|
||||
|
||||
# --- Network Config ---
|
||||
echo '*** ZeroTier Network Containers Test: ' "$test_name"
|
||||
chown -R daemon /var/lib/zerotier-one
|
||||
@ -26,11 +25,13 @@ virtip4=""
|
||||
while [ -z "$virtip4" ]; do
|
||||
sleep 0.2
|
||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||
dev=`/zerotier-cli listnetworks | grep -F "" | cut -d ' ' -f 8 | cut -d "_" -f 2 | sed "s/^<dev>//" | tr '\n' '\0'`
|
||||
done
|
||||
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '--- Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '*** Writing address to ' "$address_file"
|
||||
echo $virtip4 > "$address_file"
|
||||
|
||||
export ZT_NC_NWID=$dev
|
||||
|
||||
# --- Test section ---
|
||||
# Generate large random file for transfer test, share md5sum for monitor container to check
|
||||
|
@ -8,8 +8,8 @@ test_namefile=$(ls *.name)
|
||||
test_name="${test_namefile%.*}" # test network id
|
||||
nwconf=$(ls *.conf) # blank test network config file
|
||||
nwid="${nwconf%.*}" # test network id
|
||||
netcon_wait_time=25 # wait for test container to come online
|
||||
app_timeout_time=15 # app-specific timeout
|
||||
netcon_wait_time=35 # wait for test container to come online
|
||||
app_timeout_time=25 # app-specific timeout
|
||||
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
||||
file_base="$test_name".txt # test result output file
|
||||
fail=FAIL. # appended to result file in event of failure
|
||||
|
@ -26,11 +26,13 @@ virtip4=""
|
||||
while [ -z "$virtip4" ]; do
|
||||
sleep 0.2
|
||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||
dev=`/zerotier-cli listnetworks | grep -F "" | cut -d ' ' -f 8 | cut -d "_" -f 2 | sed "s/^<dev>//" | tr '\n' '\0'`
|
||||
done
|
||||
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '*** Writing address to ' "$address_file"
|
||||
echo $virtip4 > "$address_file"
|
||||
|
||||
export ZT_NC_NWID=$dev
|
||||
|
||||
# --- Test section ---
|
||||
# Generate large random file for transfer test, share md5sum for monitor container to check
|
||||
|
@ -8,8 +8,8 @@ test_namefile=$(ls *.name)
|
||||
test_name="${test_namefile%.*}" # test network id
|
||||
nwconf=$(ls *.conf) # blank test network config file
|
||||
nwid="${nwconf%.*}" # test network id
|
||||
netcon_wait_time=25 # wait for test container to come online
|
||||
app_timeout_time=15 # app-specific timeout
|
||||
netcon_wait_time=35 # wait for test container to come online
|
||||
app_timeout_time=25 # app-specific timeout
|
||||
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
||||
file_base="$test_name".txt # test result output file
|
||||
fail=FAIL. # appended to result file in event of failure
|
||||
|
@ -26,11 +26,13 @@ virtip4=""
|
||||
while [ -z "$virtip4" ]; do
|
||||
sleep 0.2
|
||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||
dev=`/zerotier-cli listnetworks | grep -F "" | cut -d ' ' -f 8 | cut -d "_" -f 2 | sed "s/^<dev>//" | tr '\n' '\0'`
|
||||
done
|
||||
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '*** Writing address to ' "$address_file"
|
||||
echo $virtip4 > "$address_file"
|
||||
|
||||
export ZT_NC_NWID=$dev
|
||||
|
||||
# --- Test section ---
|
||||
# Generate large random file for transfer test, share md5sum for monitor container to check
|
||||
|
@ -8,8 +8,8 @@ test_namefile=$(ls *.name)
|
||||
test_name="${test_namefile%.*}" # test network id
|
||||
nwconf=$(ls *.conf) # blank test network config file
|
||||
nwid="${nwconf%.*}" # test network id
|
||||
netcon_wait_time=25 # wait for test container to come online
|
||||
app_timeout_time=15 # app-specific timeout
|
||||
netcon_wait_time=35 # wait for test container to come online
|
||||
app_timeout_time=25 # app-specific timeout
|
||||
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
||||
file_base="$test_name".txt # test result output file
|
||||
fail=FAIL. # appended to result file in event of failure
|
||||
|
@ -26,11 +26,13 @@ virtip4=""
|
||||
while [ -z "$virtip4" ]; do
|
||||
sleep 0.2
|
||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||
dev=`/zerotier-cli listnetworks | grep -F "" | cut -d ' ' -f 8 | cut -d "_" -f 2 | sed "s/^<dev>//" | tr '\n' '\0'`
|
||||
done
|
||||
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '*** Writing address to ' "$address_file"
|
||||
echo $virtip4 > "$address_file"
|
||||
|
||||
export ZT_NC_NWID=$dev
|
||||
|
||||
# --- Test section ---
|
||||
# Generate large random file for transfer test, share md5sum for monitor container to check
|
||||
|
@ -23,11 +23,13 @@ virtip4=""
|
||||
while [ -z "$virtip4" ]; do
|
||||
sleep 0.2
|
||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||
dev=`/zerotier-cli listnetworks | grep -F "" | cut -d ' ' -f 8 | cut -d "_" -f 2 | sed "s/^<dev>//" | tr '\n' '\0'`
|
||||
done
|
||||
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '*** Writing address to ' "$address_file"
|
||||
echo $virtip4 > "$address_file"
|
||||
|
||||
export ZT_NC_NWID=$dev
|
||||
|
||||
# --- Test section ---
|
||||
echo '*** Starting application...'
|
||||
|
@ -23,11 +23,13 @@ virtip4=""
|
||||
while [ -z "$virtip4" ]; do
|
||||
sleep 0.2
|
||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||
dev=`/zerotier-cli listnetworks | grep -F "" | cut -d ' ' -f 8 | cut -d "_" -f 2 | sed "s/^<dev>//" | tr '\n' '\0'`
|
||||
done
|
||||
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '*** Writing address to ' "$address_file"
|
||||
echo $virtip4 > "$address_file"
|
||||
|
||||
export ZT_NC_NWID=$dev
|
||||
|
||||
# --- Test section ---
|
||||
echo '*** Starting application...'
|
||||
|
@ -26,11 +26,13 @@ virtip4=""
|
||||
while [ -z "$virtip4" ]; do
|
||||
sleep 0.2
|
||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||
dev=`/zerotier-cli listnetworks | grep -F "" | cut -d ' ' -f 8 | cut -d "_" -f 2 | sed "s/^<dev>//" | tr '\n' '\0'`
|
||||
done
|
||||
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||
echo '*** Writing address to ' "$address_file"
|
||||
echo $virtip4 > "$address_file"
|
||||
|
||||
export ZT_NC_NWID=$dev
|
||||
|
||||
# --- Test section ---
|
||||
# Generate large random file for transfer test, share md5sum for monitor container to check
|
||||
|
@ -1,41 +0,0 @@
|
||||
|
||||
test_name=${PWD##*/}
|
||||
echo 'Building dockerfiles for test: ' "$test_name"
|
||||
touch "$test_name".name
|
||||
|
||||
# Docker won't allow the inclusion of files outside of the build directory
|
||||
cp ../../*.conf .
|
||||
cp ../../zerotier-one zerotier-one
|
||||
cp ../../zerotier-cli zerotier-cli
|
||||
cp ../../zerotier-intercept zerotier-intercept
|
||||
cp ../../libzerotierintercept.so.1.0 libzerotierintercept.so.1.0
|
||||
cp ../../liblwip.so liblwip.so
|
||||
cp ../../netcon_identity.public netcon_identity.public
|
||||
cp ../../netcon_identity.secret netcon_identity.secret
|
||||
cp ../../monitor_identity.public monitor_identity.public
|
||||
cp ../../monitor_identity.secret monitor_identity.secret
|
||||
|
||||
docker build --tag="$test_name" -f netcon_dockerfile .
|
||||
docker build --tag="$test_name"_monitor -f monitor_dockerfile .
|
||||
|
||||
rm -f zerotier-one
|
||||
rm -f zerotier-cli
|
||||
rm -f zerotier-intercept
|
||||
rm -f libzerotierintercept.so.1.0
|
||||
rm -f liblwip.so
|
||||
rm -f netcon_identity.public
|
||||
rm -f netcon_identity.secret
|
||||
rm -f monitor_identity.public
|
||||
rm -f monitor_identity.secret
|
||||
rm -f *.conf
|
||||
rm -f *.name
|
||||
|
||||
# Start netcon container to be tested
|
||||
test_container=$(docker run -d -it -v $PWD/../../_results:/opt/results --device=/dev/net/tun "$test_name":latest)
|
||||
monitor_container=$(docker run -d -it -v $PWD/../../_results:/opt/results --device=/dev/net/tun "$test_name"_monitor:latest)
|
||||
|
||||
echo "waiting $netcon_test_wait_time for test to complete."
|
||||
sleep $netcon_test_wait_time
|
||||
docker kill $(docker ps -a -q)
|
||||
docker rm $test_container
|
||||
docker rm $monitor_container
|
@ -4,7 +4,7 @@
|
||||
rm _results/*.txt
|
||||
|
||||
# How long we shall wait for each test to conclude
|
||||
export netcon_test_wait_time=45s
|
||||
export netcon_test_wait_time=60s
|
||||
|
||||
# Test structure, in later releases more complex multi-party scripts will be included
|
||||
export testscript=two_party_test.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user