-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathtest_docker.sh
executable file
·54 lines (36 loc) · 1.11 KB
/
test_docker.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PROTO=${1:-"http"}
TAG=${2:-cryptol-remote-api}
pushd $DIR
rm -fr $DIR/python/tests/cryptol/test-files/examples
cp -r $DIR/../examples $DIR/python/tests/cryptol/test-files/
CONTAINER=$(docker run -d \
-v $DIR/python/tests/cryptol/test-files:/home/cryptol/tests/cryptol/test-files \
-p 8080:8080 \
$([[ "$PROTO" == "https" ]] && echo "-e TLS_ENABLE=1") \
$TAG)
popd
sleep 5 # let the server catch its breath and be ready for requests
pushd $DIR/python
NUM_FAILS=0
echo "Setting up python environment for remote server clients..."
poetry install
export CRYPTOL_SERVER_URL="$PROTO://localhost:8080/"
echo "Running cryptol-remote-api tests with remote server at $CRYPTOL_SERVER_URL..."
poetry run python -m unittest discover --verbose tests/cryptol
if [ $? -ne 0 ]; then
NUM_FAILS=$(($NUM_FAILS+1))
fi
popd
echo "killing docker container"
docker container kill $CONTAINER
if [ $NUM_FAILS -eq 0 ]
then
echo "All Docker RPC tests passed"
exit 0
else
echo "Some Docker RPC tests failed"
exit 1
fi