WIP: Unit tests -- more generalization

This commit is contained in:
Joseph Henry 2015-11-19 17:34:56 -08:00
commit 9a25a627bb
10 changed files with 42 additions and 8 deletions

View file

@ -8,7 +8,8 @@ EXPOSE 9993/udp
RUN mkdir -p /var/lib/zerotier-one/networks.d
ADD monitor_identity.public /var/lib/zerotier-one/identity.public
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-cli /

View file

@ -2,7 +2,7 @@
# Parameters for test
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
app_timeout_time=10 # app-specific timeout
file_path=/opt/results/ # test result output file path (fs shared between host and containers)
@ -37,7 +37,7 @@ while [ -z "$virtip4" ]; do
done
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...'
sleep "$netcon_wait_time"s
ncvirtip=$(<$address_file)

View file

@ -21,7 +21,9 @@ RUN /usr/bin/install -c intercept /usr/bin
RUN mkdir -p /var/lib/zerotier-one/networks.d
ADD netcon_identity.public /var/lib/zerotier-one/identity.public
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-cli /

View file

@ -2,7 +2,7 @@
# Parameters for test
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_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)
@ -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`
done
echo '*** Up and running at' $virtip4
echo '*** Up and running at' $virtip4 ' on network: ' $nwid
echo $virtip4 > "$address_file"
# Generate large random file for transfer test

View file

@ -3,6 +3,7 @@ testname=${PWD##*/}
echo 'Building dockerfiles for test: ' "$testname"
# 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 ../../intercept intercept
@ -13,7 +14,6 @@ cp ../../netcon_identity.secret netcon_identity.secret
cp ../../monitor_identity.public monitor_identity.public
cp ../../monitor_identity.secret monitor_identity.secret
docker build --tag="$testname" -f netcon_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 monitor_identity.public
rm -f monitor_identity.secret
rm -f *.conf
# Start netcon container to be tested
docker run -d -it -v $PWD/../../_results:/opt/results --device=/dev/net/tun "$testname":latest