diff --git a/.circleci/config.yml b/.circleci/config.yml index 841b80e0c..51e99dff4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -214,7 +214,7 @@ jobs: - store-pytest-results - store-coverage-report - py311-googlecloud: + py311googlecloud: docker: - image: cimg/python:3.11.4 - image: vanmoof/pubsub-emulator @@ -254,7 +254,7 @@ jobs: - store-pytest-results - store-coverage-report - py312-googlecloud: + py312googlecloud: docker: - image: cimg/python:3.12.0 - image: vanmoof/pubsub-emulator @@ -294,7 +294,7 @@ jobs: - store-pytest-results - store-coverage-report - py39-couchbase: + py39couchbase: docker: - image: cimg/python:3.9.17 - image: couchbase/server-sandbox:5.5.0 @@ -310,7 +310,7 @@ jobs: - store-pytest-results - store-coverage-report - py39-cassandra: + py39cassandra: docker: - image: cimg/python:3.9.17 - image: cassandra:3.11 @@ -339,7 +339,7 @@ jobs: - store-pytest-results - run_sonarqube - py39-gevent_starlette: + py39gevent_starlette: docker: - image: cimg/python:3.9.17 working_directory: ~/repo @@ -363,11 +363,11 @@ workflows: - python311 - python312 - python313 - - py39-cassandra - - py39-couchbase - - py39-gevent_starlette - - py311-googlecloud - - py312-googlecloud + - py39cassandra + - py39couchbase + - py39gevent_starlette + - py311googlecloud + - py312googlecloud - final_job: requires: - python38 @@ -376,8 +376,8 @@ workflows: - python311 - python312 - python313 - - py39-cassandra - - py39-couchbase - - py39-gevent_starlette - - py311-googlecloud - - py312-googlecloud + - py39cassandra + - py39couchbase + - py39gevent_starlette + - py311googlecloud + - py312googlecloud diff --git a/.tekton/github-pr-pipeline.yaml.part b/.tekton/github-pr-pipeline.yaml.part index b400a3c7a..1b4d5313c 100644 --- a/.tekton/github-pr-pipeline.yaml.part +++ b/.tekton/github-pr-pipeline.yaml.part @@ -29,6 +29,7 @@ spec: - unittest-cassandra - unittest-couchbase - unittest-gevent-starlette + - unittest-googlecloud taskRef: kind: Task name: github-set-status diff --git a/.tekton/pipeline.yaml b/.tekton/pipeline.yaml index b99b35b38..f0eee35cd 100644 --- a/.tekton/pipeline.yaml +++ b/.tekton/pipeline.yaml @@ -84,3 +84,19 @@ spec: workspaces: - name: task-pvc workspace: python-tracer-ci-pipeline-pvc + - name: unittest-googlecloud + runAfter: + - clone + matrix: + params: + - name: imageDigest + value: + # 3.11.9-bookworm + - "sha256:0c2928128a96e544a1ee248e50ee8ecbe840bf48ef5a49065812e3d06b6e1bcc" + # 3.12.4-bookworm + - "sha256:83f5f8714b6881d3e0e91023d9fe9e43aa6ad5a04e9f9a94ee180b18b021c72a" + taskRef: + name: python-tracer-unittest-googlecloud-task + workspaces: + - name: task-pvc + workspace: python-tracer-ci-pipeline-pvc diff --git a/.tekton/run_unittests.sh b/.tekton/run_unittests.sh index 9e1ecd377..dfcc79ebc 100755 --- a/.tekton/run_unittests.sh +++ b/.tekton/run_unittests.sh @@ -40,9 +40,13 @@ 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' 'tests/clients/test_google-cloud-pubsub.py') + export GOOGLE_CLOUD_TEST='true' ;; *) 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 1d8239760..8dea2c401 100644 --- a/.tekton/task.yaml +++ b/.tekton/task.yaml @@ -115,12 +115,34 @@ spec: apiVersion: tekton.dev/v1 kind: Task metadata: - name: python-tracer-unittest-default-task + name: python-tracer-unittest-googlecloud-task spec: sidecars: - name: google-cloud-pubsub # vanmoof/pubsub-emulator:latest image: vanmoof/pubsub-emulator@sha256:ff71206d65589b58a8b6928c35349a58dbfd7f20eb2dc7822e0f32e5c40791c8 + 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: + sidecars: - name: mariadb # mariadb:11.3.2 image: mariadb@sha256:851f05fe1e4cb290442c1b12b7108436a33fd8f6a733d4989950322d06d45c65 diff --git a/tests/conftest.py b/tests/conftest.py index 4e4baa59a..d63dea980 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,8 +6,8 @@ import sys import pytest -if importlib.util.find_spec('celery'): - pytest_plugins = ("celery.contrib.pytest", ) +if importlib.util.find_spec("celery"): + pytest_plugins = ("celery.contrib.pytest",) # Set our testing flags os.environ["INSTANA_TEST"] = "true" @@ -20,7 +20,7 @@ # Cassandra and gevent tests are run in dedicated jobs on CircleCI and will # be run explicitly. (So always exclude them here) -if not os.environ.get("CASSANDRA_TEST" ): +if not os.environ.get("CASSANDRA_TEST"): collect_ignore_glob.append("*test_cassandra*") if not os.environ.get("COUCHBASE_TEST"): @@ -38,6 +38,10 @@ # tests/opentracing/test_ot_span.py::TestOTSpan::test_stacks # TODO: Remove that once we find a workaround or DROP opentracing! +if sys.version_info >= (3, 11): + if not os.environ.get("GOOGLE_CLOUD_TEST"): + collect_ignore_glob.append("*test_google-cloud*") + if sys.version_info >= (3, 13): # TODO: Test Case failures for unknown reason: collect_ignore_glob.append("*test_aiohttp_server*") @@ -64,22 +68,21 @@ collect_ignore_glob.append("*test_grpcio*") collect_ignore_glob.append("*test_sanic*") -@pytest.fixture(scope='session') + +@pytest.fixture(scope="session") def celery_config(): return { - 'broker_connection_retry_on_startup': True, - 'broker_url': 'redis://localhost:6379', - 'result_backend': 'redis://localhost:6379' + "broker_connection_retry_on_startup": True, + "broker_url": "redis://localhost:6379", + "result_backend": "redis://localhost:6379", } -@pytest.fixture(scope='session') +@pytest.fixture(scope="session") def celery_enable_logging(): return True -@pytest.fixture(scope='session') +@pytest.fixture(scope="session") def celery_includes(): - return { - 'tests.frameworks.test_celery' - } + return {"tests.frameworks.test_celery"} diff --git a/tests/requirements-312.txt b/tests/requirements-312.txt index 27d7b1f4f..8e8aeb346 100644 --- a/tests/requirements-312.txt +++ b/tests/requirements-312.txt @@ -8,8 +8,6 @@ fastapi>=0.92.0 flask>=2.3.2 markupsafe>=2.1.0 grpcio>=1.37.1 -google-cloud-pubsub>=2.0.0 -google-cloud-storage<=2.14.0 lxml>=4.9.2 mock>=4.0.3 moto>=4.1.2