Skip to content

Commit

Permalink
currency(cloudstorage): added separate task to circleci and tekton fo…
Browse files Browse the repository at this point in the history
…r python3.11

Signed-off-by: Cagri Yonca <[email protected]>
  • Loading branch information
CagriYonca committed Nov 4, 2024
1 parent 06fa182 commit 3fda3c9
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ commands:
run-tests-with-coverage-report:
parameters:
googlecloud:
default: ""
type: string
cassandra:
default: ""
type: string
Expand All @@ -53,6 +56,7 @@ commands:
- run:
name: Run Tests With Coverage Report
environment:
GOOGLE_CLOUD_TEST: "<<parameters.googlecloud>>"
CASSANDRA_TEST: "<<parameters.cassandra>>"
COUCHBASE_TEST: "<<parameters.couchbase>>"
GEVENT_STARLETTE_TEST: "<<parameters.gevent>>"
Expand Down Expand Up @@ -210,6 +214,20 @@ jobs:
- store-pytest-results
- store-coverage-report

py311googlecloud:
docker:
- image: cimg/python:3.11.10
working_directory: ~/repo
steps:
- checkout
- pip-install-deps:
requirements: "tests/requirements-googlecloud.txt"
- run-tests-with-coverage-report:
googlecloud: "true"
tests: "tests/clients/test_google-cloud-storage.py"
- store-pytest-results
- store-coverage-report

python312:
docker:
- image: cimg/python:3.12
Expand Down Expand Up @@ -248,6 +266,20 @@ jobs:
- store-pytest-results
- store-coverage-report

py312googlecloud:
docker:
- image: cimg/python:3.12
working_directory: ~/repo
steps:
- checkout
- pip-install-deps:
requirements: "tests/requirements-googlecloud.txt"
- run-tests-with-coverage-report:
googlecloud: "true"
tests: "tests/clients/test_google-cloud-storage.py"
- store-pytest-results
- store-coverage-report

python313:
docker:
- image: cimg/python:3.13
Expand Down Expand Up @@ -347,7 +379,9 @@ workflows:
- py39cassandra
- py39couchbase
- py39gevent_starlette
- py311googlecloud
- py312aws
- py312googlecloud
- final_job:
requires:
- python38
Expand All @@ -359,4 +393,6 @@ workflows:
- py39cassandra
- py39couchbase
- py39gevent_starlette
- py311googlecloud
- py312aws
- py312googlecloud
1 change: 1 addition & 0 deletions .tekton/github-pr-pipeline.yaml.part
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ spec:
- unittest-cassandra
- unittest-couchbase
- unittest-gevent-starlette
- unittest-googlecloud
taskRef:
kind: Task
name: github-set-status
Expand Down
16 changes: 16 additions & 0 deletions .tekton/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ spec:
workspaces:
- name: task-pvc
workspace: python-tracer-ci-pipeline-pvc
- name: unittest-googlecloud
runAfter:
- clone
matrix:
params:
- name: imageDigest
value:
# 3.11.10-bookworm
- "sha256:3cd9b520be95c671135ea1318f32be6912876024ee16d0f472669d3878801651"
# 3.12.6-bookworm
- "sha256:af6fa5c329d6bd6dec52855ccb8bb37c30fb8f00819953a035d49499e43b2c9b"
taskRef:
name: python-tracer-unittest-googlecloud-task
workspaces:
- name: task-pvc
workspace: python-tracer-ci-pipeline-pvc
- name: unittest-aws
runAfter:
- clone
Expand Down
6 changes: 5 additions & 1 deletion .tekton/run_unittests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ gevent_starlette)
# export TESTS=('tests/frameworks/test_gevent.py' 'tests/frameworks/test_starlette.py')
# export GEVENT_STARLETTE_TEST='true' ;;
export TESTS=('tests/frameworks/test_starlette.py');;
googlecloud)
export REQUIREMENTS='requirements-googlecloud.txt'
export TESTS=('tests/clients/test_google-cloud-storage.py')
export GOOGLE_CLOUD_TEST='true' ;;
aws)
export REQUIREMENTS='requirements.txt'
export TESTS=('tests_aws') ;;
*)
echo "ERROR \$TEST_CONFIGURATION='${TEST_CONFIGURATION}' is unsupported " \
"not in (default|cassandra|couchbase|gevent_starlette)" >&2
"not in (default|cassandra|couchbase|gevent_starlette|googlecloud)" >&2
exit 3 ;;
esac

Expand Down
21 changes: 21 additions & 0 deletions .tekton/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,27 @@ spec:
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: python-tracer-unittest-googlecloud-task
spec:
params:
- name: imageDigest
type: string
workspaces:
- name: task-pvc
mountPath: /workspace
steps:
- name: unittest
image: python@$(params.imageDigest)
env:
- name: TEST_CONFIGURATION
value: googlecloud
workingDir: /workspace/python-sensor/
command:
- /workspace/python-sensor/.tekton/run_unittests.sh
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: python-tracer-unittest-aws-task
spec:
Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
collect_ignore_glob.append("*test_starlette*")


if not os.environ.get("GOOGLE_CLOUD_TEST"):
if sys.version_info >= (3, 11) and sys.version_info < (3, 13):
collect_ignore_glob.append("*test_google-cloud-storage*")

if sys.version_info >= (3, 13):
# Currently not installable dependencies because of 3.13 incompatibilities
collect_ignore_glob.append("*test_sanic*")
Expand Down
5 changes: 5 additions & 0 deletions tests/requirements-googlecloud.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
google-cloud-storage>=2.15.0
coverage>=5.5
pytest>=6.2.4
mock>=4.0.3
celery>=5.2.7

0 comments on commit 3fda3c9

Please sign in to comment.