Skip to content

Commit

Permalink
combined requirement files into one file and updated pipelines
Browse files Browse the repository at this point in the history
Signed-off-by: Cagri Yonca <[email protected]>
  • Loading branch information
CagriYonca committed Oct 28, 2024
1 parent 288029b commit ae5f066
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ commands:
gevent:
default: ""
type: string
googlecloud:
default: ""
type: string
tests:
default: "tests"
type: string
Expand All @@ -55,6 +58,7 @@ commands:
environment:
CASSANDRA_TEST: "<<parameters.cassandra>>"
COUCHBASE_TEST: "<<parameters.couchbase>>"
GOOGLECLOUD_TEST: "<<parameters.googlecloud>>"
GEVENT_STARLETTE_TEST: "<<parameters.gevent>>"
command: |
. venv/bin/activate
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 @@ -250,6 +268,7 @@ jobs:

python313:
docker:
- image: cimg/python:3.13
- image: cimg/python:3.13
- image: cimg/postgres:14.12
environment:
Expand Down Expand Up @@ -345,6 +364,7 @@ workflows:
- py39cassandra
- py39couchbase
# - py39gevent_starlette
- py311googlecloud
- py312aws
- final_job:
requires:
Expand All @@ -357,4 +377,5 @@ workflows:
- py39cassandra
- py39couchbase
# - py39gevent_starlette
- py311googlecloud
- py312aws
1 change: 1 addition & 0 deletions .tekton/github-pr-pipeline.yaml.part
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ spec:
- unittest-default
- unittest-cassandra
- unittest-couchbase
- unittest-googlecloud
#- unittest-gevent-starlette
taskRef:
kind: Task
Expand Down
14 changes: 14 additions & 0 deletions .tekton/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ 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"
taskRef:
name: python-tracer-unittest-googlecloud-task
workspaces:
- name: task-pvc
workspace: python-tracer-ci-pipeline-pvc
# TODO: uncomment after gevent instrumentation is complete
# - name: unittest-gevent-starlette
# runAfter:
Expand Down
6 changes: 5 additions & 1 deletion .tekton/run_unittests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ gevent_starlette)
export REQUIREMENTS='requirements-gevent-starlette.txt'
export TESTS=('tests/frameworks/test_gevent.py' 'tests/frameworks/test_starlette.py')
export GEVENT_STARLETTE_TEST='true' ;;
googlecloud)
export REQUIREMENTS='requirements-googlecloud.txt'
export TESTS=('tests/clients/test_google-cloud-storage.py')
export GOOGLECLOUD_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 @@ -114,6 +114,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-default-task
spec:
Expand Down
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
# collect_ignore_glob.append("*test_gevent*")
# collect_ignore_glob.append("*test_starlette*")

if sys.version_info == (3, 11):
if not os.environ.get("GOOGLECLOUD_TEST"):
collect_ignore_glob.append("*test_google-cloud*")

if sys.version_info >= (3, 13):
# Currently not installable dependencies because of 3.13 incompatibilities
Expand Down Expand Up @@ -189,6 +192,9 @@ def is_agent_listening(monkeypatch, request) -> None:
monkeypatch.setattr(
HostAgent, "is_agent_listening", HostAgent.is_agent_listening
)
monkeypatch.setattr(
HostAgent, "is_agent_listening", HostAgent.is_agent_listening
)
else:
monkeypatch.setattr(HostAgent, "is_agent_listening", always_true)

Expand All @@ -202,6 +208,9 @@ def lookup_agent_host(monkeypatch, request) -> None:
monkeypatch.setattr(
TheMachine, "lookup_agent_host", TheMachine.lookup_agent_host
)
monkeypatch.setattr(
TheMachine, "lookup_agent_host", TheMachine.lookup_agent_host
)
else:
monkeypatch.setattr(TheMachine, "lookup_agent_host", always_true)

Expand Down
6 changes: 6 additions & 0 deletions tests/requirements-googlecloud.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
google-cloud-storage>=1.24.0
google-api-core>=2.15.0
coverage>=5.5
pytest>=6.2.4
mock>=4.0.3
celery>=5.2.7

0 comments on commit ae5f066

Please sign in to comment.