Commit be3dda0d authored by hengwen's avatar hengwen

Run unittests and integration test separately

parent c7cd427a
#!/usr/bin/env bash
#
# (c) https://github.com/MontiCore/monticore
#
# The license generally applicable for this project
# can be found under https://github.com/MontiCore/monticore.
#
# this script serves the purpose of running integration test in gitlab-runner.
# It starts all dependent services needed before starting the tests.
# Including:
# - a remote simulator at rpc-server:6000
# - an autopilot at autopilot:10101
# - a zookeeper server at zookeeper:2181
dockerCleanUp(){
docker kill zookeeper
docker rm zookeeper
docker kill autopilot
docker rm autopilot
docker kill rpc-server
docker rm rpc-server
docker network rm $(docker network ls | grep "simulation-network" |awk '/ / { print $1 }')
}
dockerCleanUp
CURR_DIR=$(pwd)
SIMULATOR_DIR="${CURR_DIR}/../rpc"
# create network
docker network create simulation-network
# start zookeeper
docker run \
--network="simulation-network" \
-d \
--name=zookeeper \
-e "ZOO_MAX_CLIENT_CNXNS=1024" \
zookeeper:3.4
# start autopilot server(RMIServer)
docker run \
--network="simulation-network" \
--name=autopilot \
-d \
-e "ZOO_SERVERS=zookeeper" \
registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/rmimodelserver:latest \
bash -c "source ~/.bashrc &&
java -Djava.rmi.server.useLocalHostname -jar rmi-model-server.jar \
port=10101 autopilots_folder=autopilots default_config no_time os=windows"
docker run \
--network="simulation-network" \
-d \
-e "ZOO_SERVERS=zookeeper" \
--name=rpc-server \
rpc-server:latest
cd ${CURR_DIR}
#docker build -t server-test-runner -f ./docker/TestDockerfile .
docker run \
--rm --network="simulation-network" \
-e "ZOO_SERVERS=zookeeper" \
montisim-server-builder sh -c "cd restful && mvn test -Dtest=IntegrationTest -s ../settings.xml" \
2>&1 | tee result.txt
dockerCleanUp
tail -10 result.txt | grep "BUILD SUCCESS"
# code=0 if "BUILD SUCCESS" is found in the end of result.txt
code=$?
echo $code
exit $code
......@@ -10,8 +10,6 @@
# this script serves the purpose of running unitetests in gitlab-runner.
# It starts all dependent services needed before starting the tests.
# Including:
# - a remote simulator at localhost:6000
# - an autopilot at localhost:10101
# - a zookeeper server at localhost:2181
dockerCleanUp(){
......@@ -28,35 +26,10 @@ dockerCleanUp(){
dockerCleanUp
CURR_DIR=$(pwd)
SIMULATOR_DIR="${CURR_DIR}/../rpc"
# prepare docker image for rpc-server
#cd $SIMULATOR_DIR
# mvn clean install -s ../settings.xml -DskipTests
#../restful/build.sh
# create network
docker network create simulation-network
# start zookeeper
docker run \
--network="simulation-network" \
-d \
--name=zookeeper \
-e "ZOO_MAX_CLIENT_CNXNS=1024" \
zookeeper:3.4
# start autopilot server(RMIServer)
docker run \
--network="simulation-network" \
--name=autopilot \
-d \
-e "ZOO_SERVERS=zookeeper" \
registry.git.rwth-aachen.de/monticore/embeddedmontiarc/simulators/rmimodelserver:latest \
bash -c "source ~/.bashrc &&
java -Djava.rmi.server.useLocalHostname -jar rmi-model-server.jar \
port=10101 autopilots_folder=autopilots default_config no_time os=windows"
docker run \
--network="simulation-network" \
-d \
......@@ -70,13 +43,13 @@ cd ${CURR_DIR}
docker run \
--rm --network="simulation-network" \
-e "ZOO_SERVERS=zookeeper" \
montisim-server-builder sh -c "cd restful && mvn test -s ../settings.xml" \
2>&1 | tee result.txt
montisim-server-builder sh -c "cd restful && mvn test -Dtest=\!IntegrationTest* -s ../settings.xml" \
2>&1 | tee unittest.txt
dockerCleanUp
tail -10 result.txt | grep "BUILD SUCCESS"
tail -10 unittest.txt | grep "BUILD SUCCESS"
# code=0 if "BUILD SUCCESS" is found in the end of result.txt
code=$?
echo $code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment