tests: use common function to check for file existence

This addresses issue with "docker cp" in some systems.
This commit is contained in:
Nikos Mavrogiannopoulos
2015-05-20 15:51:25 +02:00
parent 76f2c91e6b
commit f4e9b2e698
6 changed files with 79 additions and 114 deletions

View File

@@ -102,18 +102,7 @@ if test $? != 0;then
stop
fi
$DOCKER exec -i -t $IMAGE_NAME occtl show users
$DOCKER exec -i -t $IMAGE_NAME occtl show user test >out$TMP 2>&1
grep "Username" out$TMP
if test $? != 0;then
cat out$TMP
kill $PID
echo "could not find user information"
stop
fi
rm -f out$TMP
retrieve_user_info test
# There is an issue in nuttcp that makes it crash under docker if
# /proc/sys/net/ipv4/tcp_adv_win_scale does not exist.
@@ -140,16 +129,11 @@ kill -INT $PID
sleep 4
TMPDIR=radius-$TMP
mkdir -p $TMPDIR
#check whether /tmp/disconnect/ok was created
rm -f $TMPDIR/not-ok
$DOCKER cp $IMAGE_NAME:/tmp/disconnect/not-ok $TMPDIR/
if test -f $TMPDIR/not-ok;then
echo "There was an issue getting stats"
check_for_file /tmp/disconnect/not-ok
if test $? = 0;then
echo "There was an issue"
stop
fi
rm -f $TMPDIR/not-ok
rm -f $TMPDIR/stats
@@ -163,15 +147,10 @@ if test -z "$OCTETS" || test "$OCTETS" = 0;then
stop
fi
rm -f $TMPDIR/ok
$DOCKER cp $IMAGE_NAME:/tmp/disconnect/ok $TMPDIR/
if ! test -f $TMPDIR/ok;then
echo "Don't know if stats were received"
ret=77
else
echo -n "stats: "
echo `cat $TMPDIR/ok`
rm -rf $TMPDIR/
check_for_file /tmp/disconnect/ok
if test $? != 0;then
echo "There was an issue getting stats"
stop
fi
ret=0