diff options
author | vitalyisaev <vitalyisaev@ydb.tech> | 2023-11-30 13:26:22 +0300 |
---|---|---|
committer | vitalyisaev <vitalyisaev@ydb.tech> | 2023-11-30 15:44:45 +0300 |
commit | 0a98fece5a9b54f16afeb3a94b3eb3105e9c3962 (patch) | |
tree | 291d72dbd7e9865399f668c84d11ed86fb190bbf /library/recipes/docker_compose/example | |
parent | cb2c8d75065e5b3c47094067cb4aa407d4813298 (diff) | |
download | ydb-0a98fece5a9b54f16afeb3a94b3eb3105e9c3962.tar.gz |
YQ Connector:Use docker-compose in integrational tests
Diffstat (limited to 'library/recipes/docker_compose/example')
6 files changed, 60 insertions, 0 deletions
diff --git a/library/recipes/docker_compose/example/Dockerfile b/library/recipes/docker_compose/example/Dockerfile new file mode 100644 index 0000000000..8e67d74e89 --- /dev/null +++ b/library/recipes/docker_compose/example/Dockerfile @@ -0,0 +1,5 @@ +FROM python:3.4-alpine +ADD . /code +WORKDIR /code +RUN pip install -r requirements.txt +CMD ["python", "app.py"] diff --git a/library/recipes/docker_compose/example/app.py b/library/recipes/docker_compose/example/app.py new file mode 100644 index 0000000000..77afcc9b6a --- /dev/null +++ b/library/recipes/docker_compose/example/app.py @@ -0,0 +1,17 @@ +import time + +import redis +from flask import Flask + + +app = Flask(__name__) +cache = redis.Redis(host='redis', port=6379) + + +@app.route('/') +def hello(): + return 'Hello World!' + + +if __name__ == "__main__": + app.run(host="0.0.0.0", debug=True) diff --git a/library/recipes/docker_compose/example/docker-compose.yml b/library/recipes/docker_compose/example/docker-compose.yml new file mode 100644 index 0000000000..780f263945 --- /dev/null +++ b/library/recipes/docker_compose/example/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.4' +services: + web: + build: + context: . + network: host + ports: + - "5000:5000" + redis: + image: "redis:alpine@sha256:66ccc75f079ab9059c900e9545bbd271bff78a66f94b45827e6901f57fb973f1" diff --git a/library/recipes/docker_compose/example/requirements.txt b/library/recipes/docker_compose/example/requirements.txt new file mode 100644 index 0000000000..1a5dc97b12 --- /dev/null +++ b/library/recipes/docker_compose/example/requirements.txt @@ -0,0 +1,2 @@ +flask +redis diff --git a/library/recipes/docker_compose/example/test.py b/library/recipes/docker_compose/example/test.py new file mode 100644 index 0000000000..c6769eab7f --- /dev/null +++ b/library/recipes/docker_compose/example/test.py @@ -0,0 +1,7 @@ +import urllib.request + + +def test_compose_works(): + request = urllib.request.urlopen("http://localhost:5000") + response = request.read().decode(request.headers.get_content_charset()) + assert 'Hello World!' in response diff --git a/library/recipes/docker_compose/example/ya.make b/library/recipes/docker_compose/example/ya.make new file mode 100644 index 0000000000..96029ca075 --- /dev/null +++ b/library/recipes/docker_compose/example/ya.make @@ -0,0 +1,19 @@ +PY3TEST() + +TEST_SRCS( + test.py +) + +# To use docker-compose.yml from another directory, set DOCKER_COMPOSE_FILE variable with Arcadia relative path to the file +# and do not forget to add the directory to the DATA macro, e.g.: +# SET(DOCKER_COMPOSE_FILE library/recipes/docker_compose/test/docker-compose-1.yml) +# DATA(arcadia/library/recipes/docker_compose/test) + +INCLUDE(${ARCADIA_ROOT}/library/recipes/docker_compose/recipe.inc) + +TAG( + ya:external + ya:force_sandbox +) + +END() |