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

Commit 4b44461

Browse files
committed
Merge
2 parents 065cad1 + 4703e92 commit 4b44461

File tree

6 files changed

+59
-10
lines changed

6 files changed

+59
-10
lines changed

cloudstate/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
Copyright 2020 Lightbend Inc.
3+
Licensed under the Apache License, Version 2.0.
4+
"""
5+
6+
from .version import __version__
7+
8+
__all__ = [
9+
'__version__',
10+
]

cloudstate/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
21
# -*- coding: utf-8 -*-
32

43
"""
4+
Copyright 2020 Lightbend Inc.
55
Licensed under the Apache License, Version 2.0.
66
"""
77

8-
__version__ = "0.5.0"
8+
__version__ = "0.5.0"

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
"""
2+
Copyright 2020 Lightbend Inc.
3+
Licensed under the Apache License, Version 2.0.
4+
"""
5+
16
from setuptools import setup, find_packages
27

38
# Load version in cloudstate package.
@@ -14,4 +19,4 @@
1419
description='Cloudstate Python Support Library',
1520
packages=find_packages(exclude=['tests', 'shoppingcart']),
1621
long_description=open('README.md').read(),
17-
zip_safe=False)
22+
zip_safe=False)

shoppingcart/Dockerfile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
FROM python:3.8.0-slim
22

3-
COPY . /app
4-
WORKDIR /app
5-
RUN pip install --user -r requirements.txt && \
6-
pip install wheel && \
7-
python setup.py bdist_wheel && \
8-
pip install dist/cloudstate-0.5.0-py3-none-any.whl
3+
COPY ./dist /dist
4+
RUN pip install /dist/cloudstate-0.5.0-py3-none-any.whl
95

10-
ENTRYPOINT python shopping_cart.py
6+
WORKDIR /app
7+
COPY ./shoppingcart ./shoppingcart
8+
ENV PYTHONPATH=/app
9+
ENTRYPOINT python ./shoppingcart/shopping_cart.py

tck/build_tck_docker_image.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env sh
2+
3+
docker build -t gcr.io/mrcllnz/cloudstate-python-tck -f shoppingcart/Dockerfile .

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)