mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-09 12:02:50 +00:00
WIP: Unit tests -- more generalization
This commit is contained in:
parent
31bc5e1559
commit
9a25a627bb
28
docker-test/README.md
Normal file
28
docker-test/README.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
To run unit tests:
|
||||||
|
|
||||||
|
1) Place a blank network config file in this directory (e.g. "e5cd7a9e1c5311ab.conf")
|
||||||
|
- This will be used to inform test-specific scripts what network to use for testing (create your own, or use the given at your own risk)
|
||||||
|
|
||||||
|
2) run build.sh
|
||||||
|
- Builds ZeroTier with Network Containers enabled
|
||||||
|
- Builds LWIP library
|
||||||
|
- Builds library harness
|
||||||
|
- Copies all aformentioned files into unit test directory to be used for building docker files
|
||||||
|
|
||||||
|
3) run test.sh
|
||||||
|
- Will (for now, one at a time), execute each unit test's (test.sh)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A) Each unit test's test.sh will:
|
||||||
|
- temporarily copy all built files into local directory
|
||||||
|
- build test container
|
||||||
|
- build monitor container
|
||||||
|
- remove temporary files
|
||||||
|
- run each container and perform test
|
||||||
|
|
||||||
|
B) Results will be written to the 'zerotierone/docker-test/_result' directory
|
||||||
|
- Results will be a combination of raw and formatted dumps to files whose names reflect the test performed
|
||||||
|
- In the event of failure, 'FAIL.' will be appended to the result file's name
|
||||||
|
- (e.g. FAIL.my_application_1.0.2.x86_64)
|
||||||
|
- In the event of success, 'OK.' will be appended
|
1
docker-test/_results/httpd_bigfile_addr.txt
Normal file
1
docker-test/_results/httpd_bigfile_addr.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
172.30.238.230
|
0
docker-test/e5cd7a9e1c5311ab.conf
Normal file
0
docker-test/e5cd7a9e1c5311ab.conf
Normal file
@ -8,7 +8,8 @@ EXPOSE 9993/udp
|
|||||||
RUN mkdir -p /var/lib/zerotier-one/networks.d
|
RUN mkdir -p /var/lib/zerotier-one/networks.d
|
||||||
ADD monitor_identity.public /var/lib/zerotier-one/identity.public
|
ADD monitor_identity.public /var/lib/zerotier-one/identity.public
|
||||||
ADD monitor_identity.secret /var/lib/zerotier-one/identity.secret
|
ADD monitor_identity.secret /var/lib/zerotier-one/identity.secret
|
||||||
RUN touch /var/lib/zerotier-one/networks.d/e5cd7a9e1c5311ab.conf
|
ADD *.conf /var/lib/zerotier-one/networks.d/
|
||||||
|
ADD *.conf /
|
||||||
ADD zerotier-one /
|
ADD zerotier-one /
|
||||||
ADD zerotier-cli /
|
ADD zerotier-cli /
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Parameters for test
|
# Parameters for test
|
||||||
test_name=httpd_bigfile
|
test_name=httpd_bigfile
|
||||||
nwid=e5cd7a9e1c5311ab # test network
|
nwid=$(ls *.conf) # test network (assume *.conf file in root directory is where we want to test)
|
||||||
netcon_wait_time=45 # wait for test container to come online
|
netcon_wait_time=45 # wait for test container to come online
|
||||||
app_timeout_time=10 # app-specific timeout
|
app_timeout_time=10 # app-specific timeout
|
||||||
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
||||||
@ -37,7 +37,7 @@ while [ -z "$virtip4" ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo '*** Starting Test...'
|
echo '*** Starting Test...'
|
||||||
echo '*** Up and running at' $virtip4
|
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||||
echo '*** Sleeping for 30s while we wait for the Network Container to come online...'
|
echo '*** Sleeping for 30s while we wait for the Network Container to come online...'
|
||||||
sleep "$netcon_wait_time"s
|
sleep "$netcon_wait_time"s
|
||||||
ncvirtip=$(<$address_file)
|
ncvirtip=$(<$address_file)
|
@ -21,7 +21,9 @@ RUN /usr/bin/install -c intercept /usr/bin
|
|||||||
RUN mkdir -p /var/lib/zerotier-one/networks.d
|
RUN mkdir -p /var/lib/zerotier-one/networks.d
|
||||||
ADD netcon_identity.public /var/lib/zerotier-one/identity.public
|
ADD netcon_identity.public /var/lib/zerotier-one/identity.public
|
||||||
ADD netcon_identity.secret /var/lib/zerotier-one/identity.secret
|
ADD netcon_identity.secret /var/lib/zerotier-one/identity.secret
|
||||||
RUN touch /var/lib/zerotier-one/networks.d/e5cd7a9e1c5311ab.conf
|
ADD *.conf /var/lib/zerotier-one/networks.d/
|
||||||
|
ADD *.conf /
|
||||||
|
|
||||||
ADD zerotier-one /
|
ADD zerotier-one /
|
||||||
ADD zerotier-cli /
|
ADD zerotier-cli /
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Parameters for test
|
# Parameters for test
|
||||||
test_name=httpd_bigfile
|
test_name=httpd_bigfile
|
||||||
nwid=e5cd7a9e1c5311ab # test network
|
nwid=$(ls *.conf) # test network
|
||||||
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
|
||||||
file_base="$test_name".txt # test result output file
|
file_base="$test_name".txt # test result output file
|
||||||
address_file="$file_path$test_name"_addr.txt # file shared between host and containers for sharing address (optional)
|
address_file="$file_path$test_name"_addr.txt # file shared between host and containers for sharing address (optional)
|
||||||
@ -31,7 +31,7 @@ while [ -z "$virtip4" ]; do
|
|||||||
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
virtip4=`/zerotier-cli listnetworks | grep -F $nwid | cut -d ' ' -f 9 | sed 's/,/\n/g' | grep -F '.' | cut -d / -f 1`
|
||||||
done
|
done
|
||||||
|
|
||||||
echo '*** Up and running at' $virtip4
|
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
|
||||||
echo $virtip4 > "$address_file"
|
echo $virtip4 > "$address_file"
|
||||||
|
|
||||||
# Generate large random file for transfer test
|
# Generate large random file for transfer test
|
@ -3,6 +3,7 @@ testname=${PWD##*/}
|
|||||||
echo 'Building dockerfiles for test: ' "$testname"
|
echo 'Building dockerfiles for test: ' "$testname"
|
||||||
|
|
||||||
# Docker won't allow the inclusion of files outside of the build directory
|
# Docker won't allow the inclusion of files outside of the build directory
|
||||||
|
cp ../../*.conf .
|
||||||
cp ../../zerotier-one zerotier-one
|
cp ../../zerotier-one zerotier-one
|
||||||
cp ../../zerotier-cli zerotier-cli
|
cp ../../zerotier-cli zerotier-cli
|
||||||
cp ../../intercept intercept
|
cp ../../intercept intercept
|
||||||
@ -13,7 +14,6 @@ cp ../../netcon_identity.secret netcon_identity.secret
|
|||||||
cp ../../monitor_identity.public monitor_identity.public
|
cp ../../monitor_identity.public monitor_identity.public
|
||||||
cp ../../monitor_identity.secret monitor_identity.secret
|
cp ../../monitor_identity.secret monitor_identity.secret
|
||||||
|
|
||||||
|
|
||||||
docker build --tag="$testname" -f netcon_dockerfile .
|
docker build --tag="$testname" -f netcon_dockerfile .
|
||||||
docker build --tag="$testname"_monitor -f monitor_dockerfile .
|
docker build --tag="$testname"_monitor -f monitor_dockerfile .
|
||||||
|
|
||||||
@ -26,6 +26,7 @@ rm -f netcon_identity.public
|
|||||||
rm -f netcon_identity.secret
|
rm -f netcon_identity.secret
|
||||||
rm -f monitor_identity.public
|
rm -f monitor_identity.public
|
||||||
rm -f monitor_identity.secret
|
rm -f monitor_identity.secret
|
||||||
|
rm -f *.conf
|
||||||
|
|
||||||
# Start netcon container to be tested
|
# Start netcon container to be tested
|
||||||
docker run -d -it -v $PWD/../../_results:/opt/results --device=/dev/net/tun "$testname":latest
|
docker run -d -it -v $PWD/../../_results:/opt/results --device=/dev/net/tun "$testname":latest
|
@ -1,2 +1,3 @@
|
|||||||
/httpd/httpd_demo/test.sh
|
/httpd/httpd_demo/test.sh
|
||||||
/httpd/throughput_httpd.2.4.6/test.sh
|
/httpd/httpd-2.4.16-1.fc23.x86_64/test.sh
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user