mirror of
https://github.com/openfaas/faas.git
synced 2025-06-11 01:36:47 +00:00
Example DIND tests
This commit is contained in:
parent
4f1260232f
commit
d29e906a2f
14
contrib/dind/Dockerfile
Normal file
14
contrib/dind/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM docker:dind
|
||||||
|
WORKDIR /root/
|
||||||
|
RUN apk --no-cache add git && \
|
||||||
|
git clone https://github.com/alexellis/faas
|
||||||
|
WORKDIR /root/faas/
|
||||||
|
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 9090
|
||||||
|
|
||||||
|
COPY entry.sh .
|
||||||
|
RUN chmod +x ./entry.sh
|
||||||
|
|
||||||
|
CMD ["./entry.sh"]
|
11
contrib/dind/entry.sh
Normal file
11
contrib/dind/entry.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
dockerd &
|
||||||
|
|
||||||
|
while [ ! -e /var/run/docker.sock ] ; do sleep 0.25 && echo "Waiting for Docker socket" ; done
|
||||||
|
|
||||||
|
docker swarm init
|
||||||
|
|
||||||
|
./deploy_stack.sh
|
||||||
|
|
||||||
|
tail -f /dev/null
|
11
contrib/dind/start.sh
Executable file
11
contrib/dind/start.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
docker rm -f faas
|
||||||
|
docker run --name faas --privileged -p 8080:8080 -p 9090:9090 -d faas:dind
|
||||||
|
|
||||||
|
./test.sh
|
||||||
|
|
||||||
|
echo "Quitting after 120 seconds."
|
||||||
|
sleep 120
|
||||||
|
|
||||||
|
docker rmi -f faas
|
69
contrib/dind/test.sh
Executable file
69
contrib/dind/test.sh
Executable file
@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
function test_gateway {
|
||||||
|
while [ true ]
|
||||||
|
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 {
|
||||||
|
while [ true ]
|
||||||
|
do
|
||||||
|
out=$(curl -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 {
|
||||||
|
while [ true ]
|
||||||
|
do
|
||||||
|
curl 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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
test_gateway
|
||||||
|
|
||||||
|
test_function func_echoit hi
|
||||||
|
test_function func_webhookstash hi
|
||||||
|
test_function func_base64 hi
|
||||||
|
test_function func_markdown "*salut*"
|
||||||
|
|
||||||
|
curl localhost:8080/system/functions -d '{"service": "stronghash", "image": "functions/alpine", "envProcess": "sha512sum", "network": "func_functions"}'
|
||||||
|
|
||||||
|
test_function_output stronghash "hi" "150a14ed5bea6cc731cf86c41566ac427a8db48ef1b9fd626664b3bfbb99071fa4c922f33dde38719b8c8354e2b7ab9d77e0e67fc12843920a712e73d558e197 -"
|
Loading…
x
Reference in New Issue
Block a user