diff --git a/.circleci/config.yml b/.circleci/config.yml index 9cc2bc7b..a4e96ccf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,6 +46,9 @@ commands: gevent: default: "" type: string + googlecloud: + default: "" + type: string tests: default: "tests" type: string @@ -55,6 +58,7 @@ commands: environment: CASSANDRA_TEST: "<>" COUCHBASE_TEST: "<>" + GOOGLECLOUD_TEST: "<>" GEVENT_STARLETTE_TEST: "<>" command: | . venv/bin/activate @@ -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 @@ -250,6 +268,7 @@ jobs: python313: docker: + - image: cimg/python:3.13 - image: cimg/python:3.13 - image: cimg/postgres:14.12 environment: @@ -345,6 +364,7 @@ workflows: - py39cassandra - py39couchbase # - py39gevent_starlette + - py311googlecloud - py312aws - final_job: requires: @@ -357,4 +377,5 @@ workflows: - py39cassandra - py39couchbase # - py39gevent_starlette + - py311googlecloud - py312aws diff --git a/.tekton/github-pr-pipeline.yaml.part b/.tekton/github-pr-pipeline.yaml.part index e032be92..4c90ba5d 100644 --- a/.tekton/github-pr-pipeline.yaml.part +++ b/.tekton/github-pr-pipeline.yaml.part @@ -28,6 +28,7 @@ spec: - unittest-default - unittest-cassandra - unittest-couchbase + - unittest-googlecloud #- unittest-gevent-starlette taskRef: kind: Task diff --git a/.tekton/pipeline.yaml b/.tekton/pipeline.yaml index e359babf..b343e208 100644 --- a/.tekton/pipeline.yaml +++ b/.tekton/pipeline.yaml @@ -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: diff --git a/.tekton/run_unittests.sh b/.tekton/run_unittests.sh index fd03ac13..b4c3ddf8 100755 --- a/.tekton/run_unittests.sh +++ b/.tekton/run_unittests.sh @@ -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 diff --git a/.tekton/task.yaml b/.tekton/task.yaml index 768df631..d5c91fc7 100644 --- a/.tekton/task.yaml +++ b/.tekton/task.yaml @@ -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: diff --git a/tests/conftest.py b/tests/conftest.py index 40068350..477e7d61 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 @@ -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) @@ -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) diff --git a/tests/requirements-googlecloud.txt b/tests/requirements-googlecloud.txt new file mode 100644 index 00000000..f6695505 --- /dev/null +++ b/tests/requirements-googlecloud.txt @@ -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