Skip to content
Permalink
Browse files

[Docker] Exit cpp-systemintegration-tests.sh if payara fails to start

* always log war file paths
* exit if start payara failed
  • Loading branch information
Thomas Reuter authored and Fleckol committed Jan 28, 2020
1 parent f99109b commit a10db3f30a19229e4ffafe6ad9ad4e72465ed886
Showing with 23 additions and 4 deletions.
  1. +23 −4 docker/joynr-cpp-base/scripts/build/cpp-systemintegration-tests.sh
@@ -12,29 +12,48 @@ echo '# start services'
echo '# This script assumes mvn was run.'
echo '####################################################'

log "start mosquitto"
mosquitto -c /etc/mosquitto/mosquitto.conf &
MOSQUITTO_PID=$!

# wait a while to allow mosquitto server to initialize
sleep 5

function stopmosquitto
{
log "stop mosquitto"
kill -TERM $MOSQUITTO_PID
wait $MOSQUITTO_PID
}

(
log "start payara"
cd /data/src/java
JOYNR_VERSION=$(mvn -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:exec)
MVN_REPO=${REPODIR:=/home/$(whoami)/.m2/repository}

ACCESS_CTRL_WAR_FILE="$MVN_REPO/io/joynr/java/backend-services/domain-access-controller-jee/$JOYNR_VERSION/domain-access-controller-jee-$JOYNR_VERSION.war"
DISCOVERY_DIRECTORY_WAR_FILE="$MVN_REPO/io/joynr/java/backend-services/discovery-directory-jee/$JOYNR_VERSION/discovery-directory-jee-$JOYNR_VERSION.war"

echo ACCESS_CTRL_WAR_FILE=$ACCESS_CTRL_WAR_FILE
echo DISCOVERY_DIRECTORY_WAR_FILE=$DISCOVERY_DIRECTORY_WAR_FILE
if [ ! -f $ACCESS_CTRL_WAR_FILE ] || [ ! -f $DISCOVERY_DIRECTORY_WAR_FILE ]; then
echo ACCESS_CTRL_WAR_FILE=$ACCESS_CTRL_WAR_FILE
echo DISCOVERY_DIRECTORY_WAR_FILE=$DISCOVERY_DIRECTORY_WAR_FILE
log "Cannot run tests: paths to ACCESS_CTRL_WAR_FILE and DISCOVERY_DIRECTORY_WAR_FILE do not exist.\nMVN_REPO=$MVN_REPO"
exit 1
fi

/data/src/docker/joynr-base/scripts/start-payara.sh -w $DISCOVERY_DIRECTORY_WAR_FILE,$ACCESS_CTRL_WAR_FILE
SUCCESS=$?
exit $SUCCESS
)
SUCCESS=$?
if [ "$SUCCESS" != "0" ]; then
echo '########################################################'
echo '# Start Payara failed with exit code:' $SUCCESS
echo '########################################################'
stopmosquitto
exit $SUCCESS
fi

# wait a while to allow backend service to startup and connect to mosquitto
sleep 5
@@ -59,8 +78,8 @@ echo '####################################################'
echo '# stop services'
echo '####################################################'

log "stop payara"
/data/src/docker/joynr-base/scripts/stop-payara.sh
kill -TERM $MOSQUITTO_PID
wait $MOSQUITTO_PID
stopmosquitto

exit $SUCCESS

0 comments on commit a10db3f

Please sign in to comment.
You can’t perform that action at this time.