run_test.sh 1.19 KB
Newer Older
Jean Meurice's avatar
Jean Meurice committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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.
#
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ROOT_DIR=$SCRIPTS_DIR/../../..
NETWORK_NAME="simulation-network"

# this script serves the purpose of running unitetests in gitlab-runner.
# It starts all dependent services needed before starting the tests.
# Including:
#   - a zookeeper server at localhost:2181

$SCRIPTS_DIR/cleanup.sh

# create network
docker network create $NETWORK_NAME

# start zookeeper
docker run \
    --network="$NETWORK_NAME" \
    -d \
    --name=zookeeper \
    -e "ZOO_MAX_CLIENT_CNXNS=1024" \
    zookeeper:latest

echo "waiting for zookeeper to start..."
sleep 5

#docker build -t server-test-runner -f ./docker/TestDockerfile .
docker run \
    --rm --network="$NETWORK_NAME" \
    -e "ZOO_SERVERS=zookeeper" \
    montisim-server-builder \
Jean Meurice's avatar
Jean Meurice committed
38
    bash -c "source ~/.bashrc && pushd rpc && mvn test -s ../settings.xml && popd && cd restful && mvn test -Dtest=\!IntegrationTest* -s ../settings.xml"
Jean Meurice's avatar
Jean Meurice committed
39
40
41
42
43
44
45

code=$?

$SCRIPTS_DIR/cleanup.sh

echo Test Status: $code
exit $code