diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index db76112d..fe95d423 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -20,7 +20,9 @@ jobs: POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - + redis: + image: redis + options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 strategy: fail-fast: false matrix: diff --git a/umap/tests/integration/test_websocket_sync.py b/umap/tests/integration/test_websocket_sync.py index 0a2306cf..a69e134f 100644 --- a/umap/tests/integration/test_websocket_sync.py +++ b/umap/tests/integration/test_websocket_sync.py @@ -1,6 +1,8 @@ import re import pytest +import redis +from django.conf import settings from playwright.sync_api import expect from umap.models import DataLayer, Map @@ -9,6 +11,18 @@ from ..base import DataLayerFactory, MapFactory DATALAYER_UPDATE = re.compile(r".*/datalayer/update/.*") +pytestmark = pytest.mark.django_db + + +def setup_function(): + # Sync client to prevent headache with pytest / pytest-asyncio and async + client = redis.from_url(settings.REDIS_URL) + # Make sure there are no dead peers in the Redis hash, otherwise asking for + # operations from another peer may never be answered + # FIXME this should not happen in an ideal world + assert client.connection_pool.connection_kwargs["db"] == 15 + client.flushdb() + @pytest.mark.xdist_group(name="websockets") def test_websocket_connection_can_sync_markers(new_page, asgi_live_server, tilelayer): diff --git a/umap/tests/settings.py b/umap/tests/settings.py index b776c083..41de66d3 100644 --- a/umap/tests/settings.py +++ b/umap/tests/settings.py @@ -29,3 +29,5 @@ PASSWORD_HASHERS = [ WEBSOCKET_ENABLED = True WEBSOCKET_BACK_PORT = "8010" WEBSOCKET_FRONT_URI = "ws://localhost:8010" + +REDIS_URL = "redis://localhost:6379/15"