-
Notifications
You must be signed in to change notification settings - Fork 33
/
test_compose.sh
executable file
·46 lines (36 loc) · 1.03 KB
/
test_compose.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
#!/usr/bin/env sh
set -e
# This script tests whether self-hosting the Dolos web-app works using the docker-compose.yml
docker compose --progress quiet down
docker compose --progress quiet pull
docker pull ghcr.io/dodona-edu/dolos-cli:latest
docker compose up --wait --detach
echo "Upload zipfile"
report_url="$(
curl -s --fail \
--form "dataset[name]=Example" \
--form "dataset[zipfile]=@./samples/javascript/simple-dataset.zip" \
http://localhost:3000/reports \
| jq -r '.url'
)"
echo "Polling $report_url until finished or failed"
while sleep 1; do
report_json="$(curl -s --fail "$report_url")"
report_status="$(printf "%s" "$report_json" | jq -r '.status')"
echo "Status is '$report_status'"
case "$report_status" in
"queued" | "running")
;;
"finished")
break
;;
*)
echo "Something went wrong:"
echo "$report_json"
exit 1
;;
esac
done
curl -s --location --fail "$report_url/data/pairs.csv"
echo "Everything is working as expected"
docker compose down