From 23c8e9d3d5a0e85d13f0678465398a5aaa22b694 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Fri, 8 Feb 2019 10:51:06 +0100 Subject: [PATCH] openvidu-recording-java: e2e test script improved --- .../src/test/resources/run-composite-test.sh | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/openvidu-recording-java/src/test/resources/run-composite-test.sh b/openvidu-recording-java/src/test/resources/run-composite-test.sh index 71d8f129..e6d69f10 100755 --- a/openvidu-recording-java/src/test/resources/run-composite-test.sh +++ b/openvidu-recording-java/src/test/resources/run-composite-test.sh @@ -13,6 +13,27 @@ CURRENT_PATH=$PWD + +### Check for write permissions in current path with current user +if [ ! -w $CURRENT_PATH ]; then + echo "User does not have write permissions in this path" + exit 1 +fi + + +### Check that no openvidu-server or openvidu-recording-java are already running +if nc -z localhost 4443; then + echo "ERROR launching openvidu-server. Port 4443 is already occupied" + echo "You may kill all openvidu processes before running the script with this command: $ sudo kill -9 \$(ps aux | grep openvidu-recording-java | awk '{print \$2}')" + exit 1 +fi +if nc -z localhost 5000; then + echo "ERROR launching openvidu-recording-java. Port 5000 is already occupied" + echo "You may kill all openvidu processes before running the script with this command: $ sudo kill -9 \$(ps aux | grep openvidu-recording-java | awk '{print \$2}')" +fi + + +### Delete repo folders if they exist rm -rf openvidu rm -rf openvidu-tutorials @@ -26,28 +47,19 @@ git clone https://github.com/OpenVidu/openvidu-tutorials.git || exit 1 git clone https://github.com/OpenVidu/openvidu.git || exit 1 -### Launch openvidu-server +### Launch openvidu-server in the background cd $CURRENT_PATH/openvidu mvn -DskipTests=true clean -DskipTests=true compile -DskipTests=true install || exit 1 cd $CURRENT_PATH/openvidu/openvidu-server - -if nc -z localhost 4443; then - echo "ERROR launching openvidu-server. Port 4443 is already occupied. Kill all processes listed by 'ps -ef | grep openvidu'" - exit 1 -fi - mvn package -Dopenvidu.recording=true -Dopenvidu.recording.path=$CURRENT_PATH/recordings exec:java &> $CURRENT_PATH/openvidu-server.log & -### Launch openvidu-recording-java app +### Launch openvidu-recording-java app in the background cd $CURRENT_PATH/openvidu-tutorials/openvidu-recording-java - -if nc -z localhost 5000; then - echo "ERROR launching openvidu-recording-java. Port 5000 is already occupied. Kill all processes listed by 'ps -ef | grep openvidu'" -fi - mvn package -DskipTests=true exec:java &> $CURRENT_PATH/openvidu-recording-java.log & + +### Wait for both processes echo "Waiting openvidu-recording-java app to launch on 5000" while ! nc -z localhost 5000; do sleep 1 @@ -63,5 +75,5 @@ done echo "openvidu-server ready" -### Launch e2e test +### Launch e2e test in the foreground mvn -Dtest=AppTestE2e -DAPP_URL=https://localhost:5000/ -DOPENVIDU_URL=https://localhost:4443/ -DOPENVIDU_SECRET=MY_SECRET -DNUMBER_OF_ATTEMPTS=30 -DRECORDING_DURATION=5 -DDURATION_THRESHOLD=5 -DRECORDING_PATH=$CURRENT_PATH/recordings test