Skip to content

Commit

Permalink
ci: Include testing with latest starlette version
Browse files Browse the repository at this point in the history
Signed-off-by: Varsha GS <varsha.gs@ibm.com>
  • Loading branch information
GSVarsha authored and Ferenc- committed Mar 18, 2024
1 parent 6cb776e commit cd2b22f
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 22 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ commands:
INSTANA_TEST: "true"
CASSANDRA_TEST: "<<parameters.cassandra>>"
COUCHBASE_TEST: "<<parameters.couchbase>>"
GEVENT_TEST: "<<parameters.gevent>>"
GEVENT_STARLETTE_TEST: "<<parameters.gevent>>"
command: |
. venv/bin/activate
coverage run --source=instana -m pytest -v --junitxml=test-results <<parameters.tests>>
Expand Down Expand Up @@ -329,17 +329,17 @@ jobs:
- store-pytest-results
- run_sonarqube

py39gevent:
py39gevent_starlette:
docker:
- image: cimg/python:3.9.17
working_directory: ~/repo
steps:
- checkout
- pip-install-deps:
requirements: "tests/requirements-gevent.txt"
requirements: "tests/requirements-gevent-starlette.txt"
- run-tests-with-coverage-report:
gevent: "true"
tests: "tests/frameworks/test_gevent.py"
tests: "tests/frameworks/test_gevent.py tests/frameworks/test_starlette.py"
- store-pytest-results
- store-coverage-report

Expand All @@ -355,7 +355,7 @@ workflows:
- python312
- py39cassandra
- py39couchbase
- py39gevent
- py39gevent_starlette
- final_job:
requires:
- python37
Expand All @@ -366,4 +366,4 @@ workflows:
- python312
- py39cassandra
- py39couchbase
- py39gevent
- py39gevent_starlette
2 changes: 1 addition & 1 deletion .tekton/github-pr-pipeline.yaml.part
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
- unittest-default
- unittest-cassandra
- unittest-couchbase
- unittest-gevent
- unittest-gevent-starlette
taskRef:
kind: Task
name: github-set-status
Expand Down
4 changes: 2 additions & 2 deletions .tekton/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spec:
workspaces:
- name: task-pvc
workspace: python-tracer-ci-pipeline-pvc
- name: unittest-gevent
- name: unittest-gevent-starlette
runAfter:
- clone
matrix:
Expand All @@ -80,7 +80,7 @@ spec:
# 3.9.18-bookworm
- "sha256:530d4ba717be787c0e2d011aa107edac6d721f8c06fe6d44708d4aa5e9bc5ec9"
taskRef:
name: python-tracer-unittest-gevent-task
name: python-tracer-unittest-gevent-starlette-task
workspaces:
- name: task-pvc
workspace: python-tracer-ci-pipeline-pvc
10 changes: 5 additions & 5 deletions .tekton/run_unittests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ couchbase)
export REQUIREMENTS='requirements-couchbase.txt'
export TESTS='tests/clients/test_couchbase.py'
export COUCHBASE_TEST='true' ;;
gevent)
export REQUIREMENTS='requirements-gevent.txt'
export TESTS='tests/frameworks/test_gevent.py'
export GEVENT_TEST='true' ;;
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' ;;
*)
echo "ERROR \$TEST_CONFIGURATION='${TEST_CONFIGURATION}' is unsupported " \
"not in (default|cassandra|couchbase|gevent)" >&2
"not in (default|cassandra|couchbase|gevent_starlette)" >&2
exit 3 ;;
esac

Expand Down
4 changes: 2 additions & 2 deletions .tekton/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ spec:
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: python-tracer-unittest-gevent-task
name: python-tracer-unittest-gevent-starlette-task
spec:
params:
- name: imageDigest
Expand All @@ -107,7 +107,7 @@ spec:
image: python@$(params.imageDigest)
env:
- name: TEST_CONFIGURATION
value: gevent
value: gevent_starlette
workingDir: /workspace/python-sensor/
command:
- /workspace/python-sensor/.tekton/run_unittests.sh
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

os.environ["INSTANA_TEST"] = "true"

if os.environ.get('GEVENT_TEST'):
if os.environ.get('GEVENT_STARLETTE_TEST'):
from gevent import monkey
monkey.patch_all()

2 changes: 1 addition & 1 deletion tests/apps/aiohttp_app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

APP_THREAD = None

if not any((os.environ.get('GEVENT_TEST'),
if not any((os.environ.get('GEVENT_STARLETTE_TEST'),
os.environ.get('CASSANDRA_TEST'),
sys.version_info < (3, 5, 3))):
APP_THREAD = launch_background_thread(server, "AIOHTTP")
2 changes: 1 addition & 1 deletion tests/apps/grpc_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time
import threading

if not any((os.environ.get('GEVENT_TEST'),
if not any((os.environ.get('GEVENT_STARLETTE_TEST'),
os.environ.get('CASSANDRA_TEST'),
sys.version_info < (3, 5, 3))):
# Background RPC application
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/tornado_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

app_thread = None

if not any((app_thread, os.environ.get('GEVENT_TEST'), os.environ.get('CASSANDRA_TEST'))):
if not any((app_thread, os.environ.get('GEVENT_STARLETTE_TEST'), os.environ.get('CASSANDRA_TEST'))):
testenv["tornado_port"] = 10813
testenv["tornado_server"] = ("http://127.0.0.1:" + str(testenv["tornado_port"]))

Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
if not os.environ.get("COUCHBASE_TEST"):
collect_ignore_glob.append("*test_couchbase*")

if not os.environ.get("GEVENT_TEST"):
if not os.environ.get("GEVENT_STARLETTE_TEST"):
collect_ignore_glob.append("*test_gevent*")
collect_ignore_glob.append("*test_starlette*")

# Python 3.10 support is incomplete yet
# TODO: Remove this once we start supporting Tornado >= 6.0
Expand Down
2 changes: 1 addition & 1 deletion tests/frameworks/test_gevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..helpers import testenv, get_spans_by_filter


@unittest.skipIf(not os.environ.get("GEVENT_TEST"), reason="")
@unittest.skipIf(not os.environ.get("GEVENT_STARLETTE_TEST"), reason="")
class TestGEvent(unittest.TestCase):
def setUp(self):
self.http = urllib3.HTTPConnectionPool('127.0.0.1', port=testenv["wsgi_port"], maxsize=20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ gevent>=1.4.0
mock>=2.0.0
pyramid>=2.0.1
pytest>=4.6
starlette>=0.12.13
urllib3>=1.26.5
uvicorn>=0.13.4

0 comments on commit cd2b22f

Please sign in to comment.