mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 16:57:00 +08:00
radius-test: include radius accounting test
This commit is contained in:
@@ -149,34 +149,49 @@ if test $? != 0;then
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
echo "Waiting for accounting report"
|
||||
sleep 60
|
||||
|
||||
kill $PID
|
||||
|
||||
sleep 4
|
||||
|
||||
TMPDIR=radius-$TMP
|
||||
mkdir -p $TMPDIR
|
||||
#check whether /tmp/disconnect/ok was created
|
||||
rm -f ./not-ok
|
||||
$DOCKER cp test_ocserv_radius:/tmp/disconnect/not-ok ./
|
||||
if test -f ./not-ok;then
|
||||
rm -f $TMPDIR/not-ok
|
||||
$DOCKER cp test_ocserv_radius:/tmp/disconnect/not-ok $TMPDIR/
|
||||
if test -f $TMPDIR/not-ok;then
|
||||
echo "There was an issue getting stats"
|
||||
stop
|
||||
fi
|
||||
rm -f ./not-ok
|
||||
rm -f $TMPDIR/not-ok
|
||||
|
||||
ret=0
|
||||
rm -f $TMPDIR/stats
|
||||
|
||||
rm -f ./tmp-full/ok
|
||||
$DOCKER cp test_ocserv_radius:/tmp/disconnect/ok ./tmp-full/
|
||||
if ! test -f ./tmp-full/ok;then
|
||||
FILE=`$DOCKER exec test_ocserv_radius ls /var/log/radius/radacct/127.0.0.1/`
|
||||
echo $DOCKER exec test_ocserv_radius cat "/var/log/radius/radacct/127.0.0.1/$FILE"
|
||||
$DOCKER exec test_ocserv_radius cat "/var/log/radius/radacct/127.0.0.1/$FILE"
|
||||
|
||||
OCTETS=`$DOCKER exec test_ocserv_radius cat "/var/log/radius/radacct/127.0.0.1/$FILE"|grep Acct-Input-Octets|tail -1|sed 's/Acct-Input-Octets = //g'`
|
||||
if test -z "$OCTETS" || test "$OCTETS" = 0;then
|
||||
echo "Interim update showed no data!"
|
||||
stop
|
||||
fi
|
||||
|
||||
rm -f $TMPDIR/ok
|
||||
$DOCKER cp test_ocserv_radius:/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 ./tmp-full/ok`
|
||||
rm -rf ./tmp-full/
|
||||
echo `cat $TMPDIR/ok`
|
||||
rm -rf $TMPDIR/
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
$DOCKER stop test_ocserv_radius
|
||||
$DOCKER rm test_ocserv_radius
|
||||
|
||||
|
||||
Reference in New Issue
Block a user