Skip to content

Commit e5cf78a

Browse files
committed
fix redis service
1 parent 5f14b82 commit e5cf78a

8 files changed

Lines changed: 52 additions & 27 deletions

File tree

.github/workflows/test-integrations-tasks.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,25 @@ jobs:
3434
matrix:
3535
python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14","3.14t"]
3636
os: [ubuntu-22.04]
37+
services:
38+
redis:
39+
image: redis
40+
options: >-
41+
--health-cmd "redis-cli ping"
42+
--health-interval 10s
43+
--health-timeout 5s
44+
--health-retries 5
45+
ports:
46+
- 6379:6379
3747
env:
3848
# 3.6/3.7 run in the python:X.Y container; tell uv to use that system Python.
3949
UV_PYTHON_PREFERENCE: ${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && 'only-system' || 'managed' }}
50+
SENTRY_PYTHON_TEST_REDIS_HOST: ${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && 'redis' || 'localhost' }}
4051
container: ${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && format('python:{0}', matrix.python-version) || null }}
4152
steps:
4253
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4354
- name: Install uv
4455
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
45-
- name: Start Redis
46-
uses: supercharge/redis-github-action@87f27ff1ab2d9e62db54b11ee5e7f78ff18f8933 # v2
4756
- name: Install Java
4857
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
4958
with:

scripts/populate_tox/package_dependencies.jsonl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/populate_tox/releases.jsonl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/populate_tox/tox.jinja

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ deps =
178178
{py3.6,py3.7,py3.8}-flask-v1.1.4: jinja2<3.1.1
179179

180180
; Install the SDK in deps so uv resolves runtime deps together with
181-
; everything above in a single pass
182-
; py3.6/py3.7 lack PEP 660 support so no editable.
183-
!py3.6-!py3.7: -e .
184-
{py3.6,py3.7}: .
181+
; everything above in a single pass.
182+
; uv only supports PEP 660 editables; py3.6's max setuptools (~59) predates
183+
; PEP 660, so fall back to a non-editable install there.
184+
!py3.6: -e .
185+
py3.6: .
185186
186187
setenv =
187188
PYTHONDONTWRITEBYTECODE=1

scripts/split_tox_gh_actions/templates/test_group.jinja

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
python-version: [{{ py_versions|join(",") }}]
99
os: [ubuntu-22.04]
1010

11-
{% if needs_docker %}
11+
{% if needs_docker or needs_postgres or needs_redis %}
1212
services:
13+
{% if needs_docker %}
1314
docker:
1415
image: docker:dind # Required for Docker network management
1516
options: --privileged # Required for Docker-in-Docker operations
16-
{% endif %}
17-
{% if needs_postgres %}
18-
services:
17+
{% endif %}
18+
{% if needs_postgres %}
1919
postgres:
2020
image: postgres
2121
env:
@@ -29,6 +29,18 @@
2929
# Maps tcp port 5432 on service container to the host
3030
ports:
3131
- 5432:5432
32+
{% endif %}
33+
{% if needs_redis %}
34+
redis:
35+
image: redis
36+
options: >-
37+
--health-cmd "redis-cli ping"
38+
--health-interval 10s
39+
--health-timeout 5s
40+
--health-retries 5
41+
ports:
42+
- 6379:6379
43+
{% endif %}
3244
{% endif %}
3345
env:
3446
# 3.6/3.7 run in the python:X.Y container; tell uv to use that system Python.
@@ -38,6 +50,9 @@
3850
SENTRY_PYTHON_TEST_POSTGRES_USER: postgres
3951
SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry
4052
{% endif %}
53+
{% if needs_redis %}
54+
SENTRY_PYTHON_TEST_REDIS_HOST: {% raw %}${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && 'redis' || 'localhost' }}{% endraw %}
55+
{% endif %}
4156
container: {% raw %}${{ (matrix.python-version == '3.6' || matrix.python-version == '3.7') && format('python:{0}', matrix.python-version) || null }}{% endraw %}
4257
steps:
4358
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -49,11 +64,6 @@
4964
uses: getsentry/action-clickhouse-in-ci@5dc8a6a50d689bd6051db0241f34849e5a36490b # v1.7
5065
{% endif %}
5166

52-
{% if needs_redis %}
53-
- name: Start Redis
54-
uses: supercharge/redis-github-action@87f27ff1ab2d9e62db54b11ee5e7f78ff18f8933 # v2
55-
{% endif %}
56-
5767
{% if needs_java %}
5868
- name: Install Java
5969
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5

tests/integrations/celery/integration_tests/test_celery_beat_cron_monitoring.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
from sentry_sdk.utils import logger
88
from tests.integrations.celery.integration_tests import run_beat
99

10-
REDIS_SERVER = "redis://127.0.0.1:6379"
10+
REDIS_SERVER = (
11+
f"redis://{os.environ.get('SENTRY_PYTHON_TEST_REDIS_HOST', '127.0.0.1')}:6379"
12+
)
1113
REDIS_DB = 15
1214

1315

tests/integrations/celery/test_celery.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import threading
23
from unittest import mock
34

@@ -59,8 +60,9 @@ def inner(
5960
# this backend requires capture_events_forksafe
6061
celery.conf.worker_max_tasks_per_child = 1
6162
celery.conf.worker_concurrency = 1
62-
celery.conf.broker_url = "redis://127.0.0.1:6379"
63-
celery.conf.result_backend = "redis://127.0.0.1:6379"
63+
redis_url = f"redis://{os.environ.get('SENTRY_PYTHON_TEST_REDIS_HOST', '127.0.0.1')}:6379"
64+
celery.conf.broker_url = redis_url
65+
celery.conf.result_backend = redis_url
6466
celery.conf.task_always_eager = False
6567

6668
# Once we drop celery 3 we can use the celery_worker fixture

tox.ini

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ envlist =
146146
{py3.6,py3.7,py3.8}-boto3-v1.17.112
147147
{py3.7,py3.10,py3.11}-boto3-v1.25.5
148148
{py3.8,py3.12,py3.13}-boto3-v1.36.26
149-
{py3.10,py3.13,py3.14,py3.14t}-boto3-v1.43.14
149+
{py3.10,py3.13,py3.14,py3.14t}-boto3-v1.43.15
150150
{py3.10,py3.13,py3.14,py3.14t}-boto3-latest
151151

152152
{py3.6,py3.7,py3.8}-chalice-v1.16.0
@@ -588,8 +588,8 @@ deps =
588588
boto3-v1.17.112: boto3==1.17.112
589589
boto3-v1.25.5: boto3==1.25.5
590590
boto3-v1.36.26: boto3==1.36.26
591-
boto3-v1.43.14: boto3==1.43.14
592-
boto3-latest: boto3==1.43.14
591+
boto3-v1.43.15: boto3==1.43.15
592+
boto3-latest: boto3==1.43.15
593593
{py3.7,py3.8}-boto3: urllib3<2.0.0
594594

595595
chalice-v1.16.0: chalice==1.16.0
@@ -979,10 +979,11 @@ deps =
979979
{py3.6,py3.7,py3.8}-flask-v1.1.4: jinja2<3.1.1
980980

981981
; Install the SDK in deps so uv resolves runtime deps together with
982-
; everything above in a single pass
983-
; py3.6/py3.7 lack PEP 660 support so no editable.
984-
!py3.6-!py3.7: -e .
985-
{py3.6,py3.7}: .
982+
; everything above in a single pass.
983+
; uv only supports PEP 660 editables; py3.6's max setuptools (~59) predates
984+
; PEP 660, so fall back to a non-editable install there.
985+
!py3.6: -e .
986+
py3.6: .
986987

987988
setenv =
988989
PYTHONDONTWRITEBYTECODE=1

0 commit comments

Comments
 (0)