tests: updated for new IPv4 assignment

This commit is contained in:
Nikos Mavrogiannopoulos
2015-02-16 23:03:29 +01:00
parent e959c8cfab
commit 8d08df70cc
6 changed files with 26 additions and 38 deletions

View File

@@ -32,14 +32,15 @@ if test -z $FEDORA && test -z $DEBIAN;then
exit 77 exit 77
fi fi
stop() {
$DOCKER stop $IMAGE_NAME
$DOCKER rm $IMAGE_NAME
exit 1
}
$LOCKFILE $LOCKFILE
if test "$UNIX" = 1;then $DOCKER stop $IMAGE_NAME >/dev/null 2>&1
$DOCKER stop test_unix >/dev/null 2>&1 $DOCKER rm $IMAGE_NAME >/dev/null 2>&1
$DOCKER rm test_unix >/dev/null 2>&1
else
$DOCKER stop test_ocserv >/dev/null 2>&1
$DOCKER rm test_ocserv >/dev/null 2>&1
fi
if test "$FEDORA" = 1;then if test "$FEDORA" = 1;then
echo "Using the fedora image" echo "Using the fedora image"
@@ -61,6 +62,7 @@ else #DEBIAN
cp docker-ocserv/Dockerfile-debian-$CONFIG docker-ocserv/Dockerfile cp docker-ocserv/Dockerfile-debian-$CONFIG docker-ocserv/Dockerfile
fi fi
rm -f docker-ocserv/ocserv docker-ocserv/ocpasswd docker-ocserv/occtl
cp ../src/ocserv ../src/ocpasswd ../src/occtl docker-ocserv/ cp ../src/ocserv ../src/ocpasswd ../src/occtl docker-ocserv/
echo "Creating image $IMAGE" echo "Creating image $IMAGE"

View File

@@ -8,6 +8,7 @@ RUN apt-get install -y libhttp-parser2.1 libpcl1 libopts25 autogen
RUN apt-get install -y libsystemd-daemon0 valgrind nuttcp openssh-server bash RUN apt-get install -y libsystemd-daemon0 valgrind nuttcp openssh-server bash
RUN apt-get install -y libtalloc2 RUN apt-get install -y libtalloc2
RUN apt-get install -y liblz4-1 RUN apt-get install -y liblz4-1
RUN apt-get install -y libfreeradius-client2
RUN sed 's/PermitRootLogin without-password/PermitRootLogin yes/g' -i /etc/ssh/sshd_config RUN sed 's/PermitRootLogin without-password/PermitRootLogin yes/g' -i /etc/ssh/sshd_config
RUN echo 'root:root' |chpasswd RUN echo 'root:root' |chpasswd
@@ -23,7 +24,6 @@ EXPOSE 22
RUN mkdir /etc/ocserv RUN mkdir /etc/ocserv
ADD key.pem /etc/ocserv/ ADD key.pem /etc/ocserv/
ADD cert.pem /etc/ocserv/ ADD cert.pem /etc/ocserv/
ADD ocserv.conf /etc/ocserv/ ADD ocserv.conf /etc/ocserv/

View File

@@ -8,6 +8,7 @@ RUN apt-get install -y libwrap0 libpam0g libseccomp2 libdbus-1-3 libreadline5 li
RUN apt-get install -y libhttp-parser2.1 libpcl1 libopts25 autogen RUN apt-get install -y libhttp-parser2.1 libpcl1 libopts25 autogen
RUN apt-get install -y libsystemd-daemon0 valgrind nuttcp openssh-server bash RUN apt-get install -y libsystemd-daemon0 valgrind nuttcp openssh-server bash
RUN apt-get install -y libtalloc2 RUN apt-get install -y libtalloc2
RUN apt-get install -y libfreeradius-client2
RUN sed 's/PermitRootLogin without-password/PermitRootLogin yes/g' -i /etc/ssh/sshd_config RUN sed 's/PermitRootLogin without-password/PermitRootLogin yes/g' -i /etc/ssh/sshd_config
RUN echo 'root:root' |chpasswd RUN echo 'root:root' |chpasswd

View File

@@ -28,14 +28,9 @@ fi
CONFIG="tcp" CONFIG="tcp"
IMAGE=ocserv-test1 IMAGE=ocserv-test1
IMAGE_NAME=test_ocserv
. ./docker-common.sh . ./docker-common.sh
stop() {
$DOCKER stop test_ocserv
$DOCKER rm test_ocserv
exit 1
}
$DOCKER run -P --privileged=true -p 5000:5000/udp -p 5001:5001/udp -p 22 -p 5551:5551/udp --tty=false -d --name test_ocserv $IMAGE $DOCKER run -P --privileged=true -p 5000:5000/udp -p 5001:5001/udp -p 22 -p 5551:5551/udp --tty=false -d --name test_ocserv $IMAGE
if test $? != 0;then if test $? != 0;then
echo "Cannot run docker image" echo "Cannot run docker image"
@@ -63,14 +58,14 @@ rm -f pass.tmp
sleep 5 sleep 5
# The client IP depends on the username so it shouldn't change. # The client IP depends on the username so it shouldn't change.
ping -w 5 192.168.1.0 ping -w 5 192.168.1.1
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot ping ocserv" echo "Cannot ping ocserv"
stop stop
fi fi
ping -w 5 192.168.1.0 -s 1500 ping -w 5 192.168.1.1 -s 1500
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot ping ocserv" echo "Cannot ping ocserv"
@@ -91,14 +86,14 @@ printf "echo root" >>echo-admin.tmp
printf "\n" >>echo-admin.tmp printf "\n" >>echo-admin.tmp
chmod 755 echo-admin.tmp chmod 755 echo-admin.tmp
export SSH_ASKPASS="./echo-admin.tmp" export SSH_ASKPASS="./echo-admin.tmp"
setsid ssh -T -F config.tmp root@192.168.1.0 occtl show user test >out.tmp 2>&1 setsid ssh -T -F config.tmp root@192.168.1.1 occtl show user test >out.tmp 2>&1
cat out.tmp cat out.tmp
printf "#\!/bin/sh\n" >echo-admin.tmp printf "#\!/bin/sh\n" >echo-admin.tmp
printf "echo root" >>echo-admin.tmp printf "echo root" >>echo-admin.tmp
printf "\n" >>echo-admin.tmp printf "\n" >>echo-admin.tmp
chmod 755 echo-admin.tmp chmod 755 echo-admin.tmp
setsid ssh -T -F config.tmp root@192.168.1.0 occtl show user test >out.tmp 2>&1 setsid ssh -T -F config.tmp root@192.168.1.1 occtl show user test >out.tmp 2>&1
cat out.tmp cat out.tmp
rm -f echo-admin.tmp rm -f echo-admin.tmp
rm -f config.tmp rm -f config.tmp
@@ -116,14 +111,14 @@ rm -f out.tmp
# There is an issue in nuttcp that makes it crash under docker if # There is an issue in nuttcp that makes it crash under docker if
# /proc/sys/net/ipv4/tcp_adv_win_scale does not exist. # /proc/sys/net/ipv4/tcp_adv_win_scale does not exist.
if test "$FEDORA" = 1;then if test "$FEDORA" = 1;then
nuttcp -T 10 -t 192.168.1.0 nuttcp -T 10 -t 192.168.1.1
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot send to ocserv" echo "Cannot send to ocserv"
stop stop
fi fi
nuttcp -T 10 -r 192.168.1.0 nuttcp -T 10 -r 192.168.1.1
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot recv from ocserv" echo "Cannot recv from ocserv"

View File

@@ -31,14 +31,9 @@ fi
CONFIG="radius" CONFIG="radius"
IMAGE=ocserv-radius-test IMAGE=ocserv-radius-test
IMAGE_NAME=test_ocserv_radius
. ./docker-common.sh . ./docker-common.sh
stop() {
$DOCKER stop test_ocserv_radius
$DOCKER rm test_ocserv_radius
exit 1
}
$DOCKER run -P --privileged=true -p $PORT:$PORT/udp -p $PORT2:$PORT2/udp -p 22 -p $PORT_OCSERV:$PORT_OCSERV/udp --tty=false -d --name test_ocserv_radius $IMAGE $DOCKER run -P --privileged=true -p $PORT:$PORT/udp -p $PORT2:$PORT2/udp -p 22 -p $PORT_OCSERV:$PORT_OCSERV/udp --tty=false -d --name test_ocserv_radius $IMAGE
if test $? != 0;then if test $? != 0;then
echo "Cannot run docker image" echo "Cannot run docker image"
@@ -66,14 +61,14 @@ rm -f pass.tmp
sleep 5 sleep 5
# The client IP depends on the username so it shouldn't change. # The client IP depends on the username so it shouldn't change.
ping -w 5 192.168.1.0 ping -w 5 192.168.1.1
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot ping ocserv" echo "Cannot ping ocserv"
stop stop
fi fi
ping -w 5 192.168.1.0 -s 1500 ping -w 5 192.168.1.1 -s 1500
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot ping ocserv" echo "Cannot ping ocserv"
@@ -94,14 +89,14 @@ printf "echo root" >>echo-admin.tmp
printf "\n" >>echo-admin.tmp printf "\n" >>echo-admin.tmp
chmod 755 echo-admin.tmp chmod 755 echo-admin.tmp
export SSH_ASKPASS="./echo-admin.tmp" export SSH_ASKPASS="./echo-admin.tmp"
setsid ssh -T -F config.tmp root@192.168.1.0 occtl show user test >out.tmp 2>&1 setsid ssh -T -F config.tmp root@192.168.1.1 occtl show user test >out.tmp 2>&1
cat out.tmp cat out.tmp
printf "#\!/bin/sh\n" >echo-admin.tmp printf "#\!/bin/sh\n" >echo-admin.tmp
printf "echo root" >>echo-admin.tmp printf "echo root" >>echo-admin.tmp
printf "\n" >>echo-admin.tmp printf "\n" >>echo-admin.tmp
chmod 755 echo-admin.tmp chmod 755 echo-admin.tmp
setsid ssh -T -F config.tmp root@192.168.1.0 occtl show user test >out.tmp 2>&1 setsid ssh -T -F config.tmp root@192.168.1.1 occtl show user test >out.tmp 2>&1
cat out.tmp cat out.tmp
rm -f echo-admin.tmp rm -f echo-admin.tmp
rm -f config.tmp rm -f config.tmp
@@ -119,14 +114,14 @@ rm -f out.tmp
# There is an issue in nuttcp that makes it crash under docker if # There is an issue in nuttcp that makes it crash under docker if
# /proc/sys/net/ipv4/tcp_adv_win_scale does not exist. # /proc/sys/net/ipv4/tcp_adv_win_scale does not exist.
if test "$FEDORA" = 1;then if test "$FEDORA" = 1;then
nuttcp -T 10 -t 192.168.1.0 nuttcp -T 10 -t 192.168.1.1
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot send to ocserv" echo "Cannot send to ocserv"
stop stop
fi fi
nuttcp -T 10 -r 192.168.1.0 nuttcp -T 10 -r 192.168.1.1
if test $? != 0;then if test $? != 0;then
kill $PID kill $PID
echo "Cannot recv from ocserv" echo "Cannot recv from ocserv"

View File

@@ -29,14 +29,9 @@ fi
UNIX=1 UNIX=1
CONFIG="unix" CONFIG="unix"
IMAGE=ocserv-test2 IMAGE=ocserv-test2
IMAGE_NAME=test_unix
. ./docker-common.sh . ./docker-common.sh
stop() {
$DOCKER stop test_unix
$DOCKER rm test_unix
exit 1
}
$DOCKER run -P --privileged=true -p 6000:6000/udp -p 6001:6001/udp -p 22 -p 6551:6551/udp --tty=false -d --name test_unix $IMAGE $DOCKER run -P --privileged=true -p 6000:6000/udp -p 6001:6001/udp -p 22 -p 6551:6551/udp --tty=false -d --name test_unix $IMAGE
if test $? != 0;then if test $? != 0;then
echo "Cannot run docker image" echo "Cannot run docker image"