forked from openfaas/faas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·73 lines (57 loc) · 1.27 KB
/
test.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
#!/bin/bash
function test_gateway {
for i in {1..100}
do
curl -s localhost:8080 |grep "angular"
if [ ! 0 -eq $? ]
then
echo "Gateway not ready"
sleep 5
else
break
fi
done
echo
}
function test_function_output {
for i in {1..100}
do
out=$(curl --fail -s localhost:8080/function/$1 -d "$2")
echo $out
if [ "$out" == "$3" ]
then
echo "Service $1 is ready"
break
else
echo "Service $1 not ready"
sleep 1
fi
done
echo
}
function test_function {
for i in {1..100}
do
curl -s --fail localhost:8080/function/$1 -d "$2"
if [ ! 0 -eq $? ]
then
echo "Service $1 not ready"
sleep 1
else
echo "Service $1 is ready"
break
fi
done
echo
}
function create_function {
echo "Creating function: " $1
curl -s --fail localhost:8080/system/functions -d "$1"
}
test_gateway
test_function func_echoit hi
test_function func_webhookstash hi
test_function func_base64 hi
test_function func_markdown "*salut*"
create_function '{"service": "stronghash", "image": "functions/alpine", "envProcess": "sha512sum", "network": "func_functions"}'
test_function_output stronghash "hi" "150a14ed5bea6cc731cf86c41566ac427a8db48ef1b9fd626664b3bfbb99071fa4c922f33dde38719b8c8354e2b7ab9d77e0e67fc12843920a712e73d558e197 -"