-
Notifications
You must be signed in to change notification settings - Fork 298
/
run-solid-test-suite.sh
executable file
·75 lines (65 loc) · 2.66 KB
/
run-solid-test-suite.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
function setup {
echo Branch name: $1
docker network create testnet
docker build -t server --build-arg BRANCH=$1 test/surface/docker/server
docker build -t cookie test/surface/docker/cookie
docker run -d --env-file test/surface/server-env.list --name server --network=testnet -v `pwd`:/travis -w /node-solid-server server /travis/bin/solid-test start --config-file /node-solid-server/config.json
docker run -d --env-file test/surface/thirdparty-env.list --name thirdparty --network=testnet -v `pwd`/test/surface:/surface server /node-solid-server/bin/solid-test start --config-file /surface/thirdparty-config.json
}
function teardown {
docker stop `docker ps --filter network=testnet -q`
docker rm `docker ps --filter network=testnet -qa`
docker network remove testnet
}
function waitForNss {
docker pull solidtestsuite/webid-provider-tests
until docker run --rm --network=testnet solidtestsuite/webid-provider-tests curl -kI https://$1 2> /dev/null > /dev/null
do
echo Waiting for $1 to start, this can take up to a minute ...
docker ps -a
docker logs $1
sleep 1
done
docker logs $1
echo Getting cookie for $1...
export COOKIE_$1="`docker run --cap-add=SYS_ADMIN --network=testnet --env-file test/surface/$1-env.list cookie`"
}
function runTests {
docker pull solidtestsuite/$1:$2
echo "Running $1 against server with cookie $COOKIE_server"
docker run --rm --network=testnet \
--env COOKIE="$COOKIE_server" \
--env COOKIE_ALICE="$COOKIE_server" \
--env COOKIE_BOB="$COOKIE_thirdparty" \
--env-file test/surface/$1-env.list solidtestsuite/$1:$2
}
function runTestsFromGit {
docker build https://github.com/solid-contrib/$1.git#$2 -t $1
echo "Running web-access-control-tests against server with cookie $COOKIE_server"
docker run --rm --network=testnet \
--env COOKIE="$COOKIE_server" \
--env COOKIE_ALICE="$COOKIE_server" \
--env COOKIE_BOB="$COOKIE_thirdparty" \
--env-file test/surface/$1-env.list $1
}
# ...
teardown || true
setup $1
waitForNss server
runTests webid-provider-tests v2.0.3
runTestsFromGit solid-crud-tests v6.0.0-issue#1743
waitForNss thirdparty
# runTests web-access-control-tests v7.1.0
runTestsFromGit web-access-control-tests patchAppendNewDocument
teardown
# To debug, e.g. running web-access-control-tests jest interactively,
# comment out `teardown` and uncomment this instead:
# env
# docker run -it --network=testnet \
# --env COOKIE="$COOKIE_server" \
# --env COOKIE_ALICE="$COOKIE_server" \
# --env COOKIE_BOB="$COOKIE_thirdparty" \
# --env-file test/surface/web-access-control-tests-env.list \
# solidtestsuite/web-access-control-tests:latest /bin/bash