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

Commit 598919b

Browse files
authored
Merge pull request #22 from cloudstateio/wip-docker-tck
Wip docker tck
2 parents 3a4c3b2 + 0292dcf commit 598919b

10 files changed

Lines changed: 80 additions & 9 deletions

File tree

cloudstate/version.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# -*- coding: utf-8 -*-
3+
4+
"""
5+
Licensed under the Apache License, Version 2.0.
6+
"""
7+
8+
__version__ = "0.5.0"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
attrs==19.3.0
2+
google-api==0.1.12
23
grpcio==1.28.1
34
grpcio-tools==1.28.1
45
protobuf==3.11.3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ fetch "frontend/cloudstate/entity_key.proto" $tag
3030
# dependencies
3131
fetch "proxy/grpc/reflection/v1alpha/reflection.proto" $tag
3232
fetch "frontend/google/api/annotations.proto" $tag
33-
fetch "frontend/google/api/http.proto" $tag
33+
fetch "frontend/google/api/http.proto" $tag

setup.cfg

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
1+
[metadata]
2+
url = https://cloudstate.io/
3+
author = Cloudstate
4+
#author_email = sleipnir@bsd.com.br
5+
license = Apache
6+
license_file = LICENSE
7+
classifiers =
8+
Intended Audience :: Developers
9+
License :: OSI Approved :: Apache Version 2
10+
Operating System :: OS Independent
11+
Programming Language :: Python
12+
Programming Language :: Python :: 3.8
13+
project_urls =
14+
Documentation = https://cloudstate.io/docs/user/lang/index.html
15+
Source = https://github.com/cloudstateio/python-support
16+
17+
[options]
18+
python_requires = >=3.6
19+
packages = find:
20+
include_package_data = true
21+
zip_safe = false
22+
install_requires =
23+
protobuf == 3.11.3
24+
google-api == 0.1.12
25+
grpcio == 1.28.1
26+
grpcio-tools == 1.28.1
27+
attrs == 19.3.0
28+
129
[aliases]
230
test=pytest
31+
332
[tool:pytest]
433
python_files = cloudstate/tests/test_*.py

setup.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
from setuptools import setup, find_packages
2-
3-
setup(name='cloudstate',
4-
version='0.1.0',
5-
url='https://github.com/marcellanz/cloudstate_python-support',
2+
3+
# Load version in cloudstate package.
4+
exec(open('cloudstate/version.py').read())
5+
version = __version__
6+
name = 'cloudstate'
7+
8+
print(f'package name: {name}, version: {version}', flush=True)
9+
10+
setup(name=name,
11+
version=version,
12+
url='https://github.com/cloudstateio/python-support',
613
license='Apache 2.0',
7-
description='Cloudstate Python Support',
14+
description='Cloudstate Python Support Library',
815
packages=find_packages(exclude=['tests', 'shoppingcart']),
916
long_description=open('README.md').read(),
1017
zip_safe=False)

shoppingcart/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
FROM python:3.8.0-slim
2+
23
COPY . /app
34
RUN apt-get update \
4-
&& apt-get install gcc -y \
5-
&& apt-get clean
5+
&& apt-get install gcc -y \
6+
&& apt-get clean
7+
68
WORKDIR app
79
RUN pip install --user -r requirements.txt
810
ENTRYPOINT python shopping_cart.py

shoppingcart/shopping_cart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from cloudstate.cloud_state import CloudState
1+
from cloudstate.cloudstate import CloudState
22
from shoppingcart.shopping_cart_entity import entity as shopping_cart_entity
33
import logging
44

tck.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
# Run Python shoppingcart here
4+
python shoppingcart/shopping_cart.py &
5+
pid=$!
6+
echo "Start python shoppingcart user-function with pid $pid"
7+
sleep 3
8+
9+
# The host network usually doesn't work on MacOS systems
10+
# so we should address this issue and use the docker's internal network when the system is Mac
11+
echo "Starting Cloudstate proxy in development mode via docker"
12+
docker run -d --name cloudstate-proxy --net=host -e USER_FUNCTION_PORT=8090 cloudstateio/cloudstate-proxy-dev-mode
13+
14+
echo "Starting TCK via docker"
15+
docker run --rm --name cloudstate-tck --net=host cloudstateio/cloudstate-tck
16+
status=$?
17+
18+
echo "Removing cloudstate-proxy docker image"
19+
docker rm -f cloudstate-proxy
20+
21+
echo "Stopping Shoppingcart user-function"
22+
kill -9 $pid
23+
24+
exit $status

0 commit comments

Comments
 (0)