Started work on automated unit test scripts

This commit is contained in:
Joseph Henry 2015-11-17 02:28:23 -08:00
parent f5c2600ca4
commit a660ec490e
14 changed files with 165 additions and 12 deletions

View File

@ -1,6 +1,5 @@
# A basic harnessed application example using ZeroTier-One and user-space IP stack
FROM fedora:20
FROM fedora:23
MAINTAINER https://www.zerotier.com/
# Install Apache
@ -8,32 +7,31 @@ RUN yum -y update && yum clean all
RUN yum -y install httpd && yum clean all
# Add files
ADD zerotier-one /
ADD zerotier-cli /
ADD intercept /
ADD lib/libintercept.so.1.0 /
ADD lib/liblwip.so /
ADD htdocs/index.html /
ADD htdocs/ZeroTierIcon.png /
RUN cp libintercept.so.1.0 lib/libintercept.so.1.0
RUN cp liblwip.so lib/liblwip.so
# Install sys-call intercept library
ADD zerotier-one /
ADD zerotier-cli /
ADD intercept /
ADD libintercept.so.1.0 /
ADD liblwip.so /
RUN cp liblwip.so lib/liblwip.so
RUN cp libintercept.so.1.0 /lib/libintercept.so.1.0
RUN ln -sf /lib/libintercept.so.1.0 /lib/libintercept
RUN /usr/bin/install -c intercept /usr/bin
RUN echo "Apache" >> /var/www/html/index.html
EXPOSE 9993/udp
RUN mv index.html /var/www/html/index.html
RUN mv ZeroTierIcon.png /var/www/html/ZeroTierIcon.png
# Start ZeroTier-One
RUN mkdir -p /var/lib/zerotier-one/networks.d
RUN touch /var/lib/zerotier-one/networks.d/8056c2e21c000001.conf
ADD entrypoint.sh /entrypoint.sh
RUN chmod -v +x /entrypoint.sh
CMD ["./entrypoint.sh"]

18
docker-test/httpd_demo/build.sh Executable file
View File

@ -0,0 +1,18 @@
cd ../../
make clean
make
cd netcon
make -f make-intercept.mk lib
rm *.o
rm liblwip.so
make -f make-liblwip.mk
cd ../docker-test/httpd_demo
cp ../../zerotier-one zerotier-one
cp ../../zerotier-cli zerotier-cli
cp ../../netcon/liblwip.so liblwip.so
cp ../../netcon/libintercept.so.1.0 libintercept.so.1.0
cp ../../netcon/intercept intercept

View File

@ -2,6 +2,8 @@
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/
touch /opt/results/results.txt
echo '***'
echo '*** ZeroTier Network Containers Preview'
echo '*** https://www.zerotier.com/'

2
docker-test/httpd_demo/test.sh Executable file
View File

@ -0,0 +1,2 @@
docker build --tag="throughput_httpd_2.4.6" .
docker run -it -v $PWD/../_results:/opt/results --device=/dev/net/tun throughput_httpd_2.4.6:latest

View File

@ -0,0 +1,40 @@
# ZT Netcon Throughput test
FROM fedora:23
MAINTAINER https://www.zerotier.com/
# Install apps
RUN yum -y update
RUN yum -y install httpd-2.4.17-3.fc23
RUN yum -y install nano
RUN yum -y install strace
RUN yum clean all
EXPOSE 9993/udp 9992/udp 9991/udp 9990/udp
# Install sys-call intercept library
ADD intercept /
ADD libintercept.so.1.0 /
RUN cp libintercept.so.1.0 lib/libintercept.so.1.0
RUN cp libintercept.so.1.0 /lib/libintercept.so.1.0
RUN ln -sf /lib/libintercept.so.1.0 /lib/libintercept
RUN /usr/bin/install -c intercept /usr/bin
# Add ZT files
RUN mkdir -p /var/lib/zerotier-one/networks.d
RUN touch /var/lib/zerotier-one/networks.d/e5cd7a9e1c5311ab.conf
ADD zerotier-one /
ADD zerotier-cli /
# Install test-setup scripts
ADD generate_file.sh /generate_file.sh
RUN chmod -v +x /generate_file.sh
ADD entrypoint.sh /entrypoint.sh
RUN chmod -v +x /entrypoint.sh
# Install LWIP library used by service
ADD liblwip.so /
RUN mkdir -p ext/bin/lwip
RUN cp liblwip.so ext/bin/lwip/liblwip.so
# Start ZeroTier-One
CMD ["./entrypoint.sh"]

View File

@ -0,0 +1,18 @@
cd ../../
make clean
make
cd netcon
make -f make-intercept.mk lib
rm *.o
rm liblwip.so
make -f make-liblwip.mk
cd ../docker-test/redis-3.0.4-1.fc23.x86_64
cp ../../zerotier-one zerotier-one
cp ../../zerotier-cli zerotier-cli
cp ../../netcon/liblwip.so liblwip.so
cp ../../netcon/libintercept.so.1.0 libintercept.so.1.0
cp ../../netcon/intercept intercept

View File

@ -0,0 +1,14 @@
#!/bin/bash
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/
echo '***'
echo '*** ZeroTier Network Containers Test Image'
echo '*** https://www.zerotier.com/'
echo '***'
./zerotier-one &
./zerotier-cli join e5cd7a9e1c5311ab
./zerotier-cli listnetworks

View File

@ -0,0 +1 @@
dd if=/dev/urandom of=/var/www/html/big bs=100M count=1

2
docker-test/test.sh Executable file
View File

@ -0,0 +1,2 @@
/httpd_demo/test.sh
/throughput_httpd.2.4.6/test.sh

View File

@ -1,5 +1,7 @@
#!/bin/bash
touch /opt/results/results.txt
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/
echo '***'

View File

@ -0,0 +1,54 @@
#!/bin/sh
# usage:
# /usr/bin/intercept program <args>
if [ $# = 0 ] ; then
echo "$0: insufficient arguments"
exit
fi
case "$1" in
on)
if [ -z "$LD_PRELOAD" ]
then
export LD_PRELOAD="/lib/libintercept.so.1.0"
else
echo $LD_PRELOAD | grep -q "/lib/libintercept\.so.1.0" || \
export LD_PRELOAD="/lib/libintercept.so $LD_PRELOAD"
fi
;;
off)
export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/lib\/libintercept.so.1.0 \?//'`
if [ -z "$LD_PRELOAD" ]
then
unset LD_PRELOAD
fi
;;
show|sh)
echo "LD_PRELOAD=\"$LD_PRELOAD\""
;;
-h|-?)
echo ""
;;
*)
if [ -z "$LD_PRELOAD" ]
then
export LD_PRELOAD="/lib/libintercept.so.1.0"
else
echo $LD_PRELOAD | grep -q "/lib/libintercept\.so.1.0" || \
export LD_PRELOAD="/lib/libintercept.so.1.0 $LD_PRELOAD"
fi
if [ $# = 0 ]
then
${SHELL:-/bin/sh}
fi
if [ $# -gt 0 ]
then
exec "$@"
fi
;;
esac
#EOF

View File

@ -0,0 +1,2 @@
docker build --tag="throughput_httpd_2.4.6" .
docker run -it -v $PWD/../_results:/opt/results --device=/dev/net/tun throughput_httpd_2.4.6:latest

View File

@ -100,7 +100,7 @@ Network Containers have been tested with the following:
curl [ WORKS as of 20151021]
apache (debug mode) [ WORKS as of 20150810]
apache (prefork MPM) [ WORKS as of 20151112] (2.4.6-31.x86-64 on Centos 7), (2.4.16-1.x84-64 on F22), (2.4.17-3.x86-64 on F22)
nginx [ WORKS as of 20151022]
nginx [BROKEN as of 20151022] 1.8.0-3 and 1.8.0-4 both suffer from lost intercept connections
nodejs [ WORKS as of 20151021]
java [ WORKS as of 20151010]
tomcat [ WORKS as of 2015xxxx]

Binary file not shown.