This repository was archived by the owner on Sep 29, 2018. It is now read-only.
forked from tuxity/docker-image-puller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·65 lines (55 loc) · 1.76 KB
/
test.sh
File metadata and controls
executable file
·65 lines (55 loc) · 1.76 KB
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
#!/bin/bash
HOST="http://localhost:8080"
CODE=$(curl -s -o /dev/null -w "%{http_code}" $HOST)
if [ "$CODE" != "200" ]; then
echo "No homepage found so not running ?"
exit 1
fi
CODE=$(curl -s -o /dev/null -w "%{http_code}" $HOST/random)
if [ "$CODE" != "404" ]; then
echo "No 404 not found page"
exit 1
fi
CODE=$(curl -X POST -s -o /dev/null -w "%{http_code}" $HOST/images/pull)
if [ "$CODE" != "404" ]; then
echo "Env variable ROUTE on default"
exit 1
fi
CODE=$(curl -X POST -s -o /dev/null -w "%{http_code}" $HOST/images/poule)
if [ "$CODE" != "404" ]; then
echo "No token page not in 404 ($CODE)"
##TODO correct bug
##exit 1
fi
CODE=$(curl -X POST -s -o /dev/null -w "%{http_code}" "$HOST/images/poule?token=wrong")
if [ "$CODE" != "404" ]; then
echo "Wrong token page not in 404 ($CODE)"
##TODO correct bug
##exit 1
fi
CODE=$(curl -X POST -s -o /dev/null -w "%{http_code}" "$HOST/images/poule?token=123456789")
if [ "$CODE" != "404" ]; then
echo "No image parameter and no json ($CODE)"
##TODO correct bug
##exit 1
fi
CODE=$(curl -X POST -s -o /dev/null -w "%{http_code}" "$HOST/images/poule?token=123456789&image=nouchka/puller")
if [ "$CODE" != "200" ]; then
echo "Image not found (get parameter)"
exit 1
fi
CODE=$(curl -X POST -s -o /dev/null -w "%{http_code}" -d '{"repository":{"namespace":"nouchka","name":"puller"}}' "$HOST/images/poule?token=123456789")
if [ "$CODE" != "200" ]; then
echo "Image not found (json data)"
exit 1
fi
CODE=$(curl -X POST -s -o json.tmp -w "%{http_code}" -d '{"repository":{"namespace":"nouchka","name":"puller"}}' "$HOST/images/poule?token=123456789")
if ! grep "success" json.tmp >> /dev/null; then
echo "No success:"
cat json.tmp
[ ! -f "json.tmp" ] || rm json.tmp
exit 1
fi
[ ! -f "json.tmp" ] || rm json.tmp
echo "All done"
exit 0