-
Notifications
You must be signed in to change notification settings - Fork 7
/
run-solid-test-suite.sh
executable file
·88 lines (75 loc) · 3.22 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
set -e
function setup {
# Run the Solid test-suite
docker network create testnet
# Build and start Nextcloud server with code from current repo contents:
docker build -t standalone-solid-server .
docker build -t cookie https://github.com/pdsinterop/test-suites.git#main:servers/php-solid-server/cookie
docker build -t pubsub-server https://github.com/pdsinterop/php-solid-pubsub-server.git#main
docker pull solidtestsuite/webid-provider-tests:v2.0.3
docker tag solidtestsuite/webid-provider-tests:v2.0.3 webid-provider-tests
docker pull solidtestsuite/solid-crud-tests:v6.0.0
docker tag solidtestsuite/solid-crud-tests:v6.0.0 solid-crud-tests
docker pull solidtestsuite/web-access-control-tests:v7.0.0
docker tag solidtestsuite/web-access-control-tests:v7.0.0 web-access-control-tests
}
function runPss {
docker run -d --name server --network=testnet --env-file ./env-vars-for-test-image.list standalone-solid-server
docker run -d --name thirdparty --network=testnet --env-file ./env-vars-for-third-party.list standalone-solid-server
docker run -d --name pubsub --network=testnet pubsub-server
until docker run --rm --network=testnet webid-provider-tests curl -kI https://server 2> /dev/null > /dev/null
do
echo Waiting for server to start, this can take up to a minute ...
docker ps -a
docker logs server
sleep 1
done
docker ps -a
docker logs server
echo Confirmed that https://server is started now
echo Getting cookie for Alice...
export COOKIE="`docker run --rm --cap-add=SYS_ADMIN --network=testnet -e SERVER_TYPE=php-solid-server --env-file ./env-vars-for-test-image.list cookie`"
if [[ $COOKIE == PHPSESSID* ]]
then
echo Successfully obtained cookie for Alice: $COOKIE
else
echo Error obtaining cookie for Alice, stopping.
exit 1
fi
until docker run --rm --network=testnet webid-provider-tests curl -kI https://thirdparty 2> /dev/null > /dev/null
do
echo Waiting for thirdparty to start, this can take up to a minute ...
docker ps -a
docker logs thirdparty
sleep 1
done
docker ps -a
docker logs thirdparty
echo Confirmed that https://thirdparty is started now
echo Getting cookie for Bob...
export COOKIE_BOB="`docker run --rm --cap-add=SYS_ADMIN --network=testnet -e SERVER_TYPE=php-solid-server --env-file ./env-vars-for-third-party.list cookie`"
if [[ $COOKIE_BOB == PHPSESSID* ]]
then
echo Successfully obtained cookie for Bob: $COOKIE_BOB
else
echo Error obtaining cookie for Bob, stopping.
exit 1
fi
}
function runTests {
echo "Running webid-provider tests with cookie $COOKIE"
docker run --rm --network=testnet --env COOKIE="$COOKIE" --env-file ./env-vars-for-test-image.list webid-provider-tests
docker run --rm --network=testnet --env COOKIE="$COOKIE" --env-file ./env-vars-for-test-image.list solid-crud-tests
docker run --rm --network=testnet --env COOKIE="$COOKIE" --env COOKIE_ALICE="$COOKIE" --env COOKIE_BOB="$COOKIE_BOB" --env-file ./env-vars-for-test-image.list web-access-control-tests
}
function teardown {
docker stop `docker ps --filter network=testnet -q`
docker rm `docker ps --filter network=testnet -qa`
docker network remove testnet
}
teardown || true
setup
runPss
runTests
# teardown