Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit a4bafec

Browse files
committed
[tck] add the tck run script.
1 parent f943ade commit a4bafec

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

tck/run_tck.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -o nounset
3+
4+
function rnd() {
5+
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
6+
}
7+
8+
FUNC_IMAGE=${1:-gcr.io/mrcllnz/cloudstate-python-tck:latest}
9+
FUNC="cloudstate-function-$(rnd)"
10+
PROXY_IMAGE=${2:-cloudstateio/cloudstate-proxy-dev-mode:latest}
11+
PROXY="cloudstate-proxy-$(rnd)"
12+
TCK_IMAGE=${3:-cloudstateio/cloudstate-tck:latest}
13+
TCK="cloudstate-tck-$(rnd)"
14+
15+
finally() {
16+
docker rm -f "$PROXY"
17+
docker rm -f "$FUNC"
18+
}
19+
trap finally EXIT
20+
set -x
21+
22+
# run the function and the proxy
23+
docker run -d --name "$FUNC" --net=host "${FUNC_IMAGE}" || exit $?
24+
docker run -d --name "$PROXY" --net=host -e USER_FUNCTION_PORT=8090 "${PROXY_IMAGE}" || exit $?
25+
26+
# run the tck
27+
docker run --rm --name "$TCK" --net=host "${TCK_IMAGE}"
28+
tck_status=$?
29+
if [ "$tck_status" -ne "0" ]; then
30+
docker logs "$FUNC"
31+
fi
32+
exit $tck_status

0 commit comments

Comments
 (0)