Skip to content

Commit fc2470c

Browse files
committed
valkey tests
1 parent 5fc268d commit fc2470c

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

.github/workflows/test.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,39 @@ jobs:
3030
test:
3131
needs: [ 'flake8' ]
3232
runs-on: ubuntu-latest
33-
name: "Run tests ${{ matrix.python-version }}/${{ matrix.django-version }}/${{ matrix.fake-redis }}"
33+
name: "Run tests ${{ matrix.python-version }}/${{ matrix.django-version }}/${{ matrix.broker }}"
3434
strategy:
3535
max-parallel: 6
3636
matrix:
3737
python-version: [ '3.10', '3.11', '3.12' ]
3838
django-version: [ '5.0.7', '5.1.1' ]
39-
fake-redis: ['True', 'False']
39+
broker: [ 'redis', 'fakeredis' ]
4040
include:
4141
- python-version: '3.12'
4242
django-version: '5.1.1'
43-
fake-redis: 'False'
43+
broker: 'redis'
4444
coverage: yes
4545

4646
services:
4747
redis:
4848
image: redis:7.2.2
4949
ports:
5050
- 6379:6379
51-
options: >-
52-
--health-cmd "redis-cli ping"
53-
--health-interval 10s
54-
--health-timeout 5s
55-
--health-retries 5
51+
healthcheck:
52+
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
53+
interval: 1s
54+
timeout: 3s
55+
retries: 5
56+
57+
valkey:
58+
image: valkey/valkey:8.0
59+
ports:
60+
- 6380:6379
61+
healthcheck:
62+
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
63+
interval: 1s
64+
timeout: 3s
65+
retries: 5
5666

5767
outputs:
5868
version: ${{ steps.getVersion.outputs.VERSION }}
@@ -91,7 +101,12 @@ jobs:
91101
if: ${{ matrix.coverage != 'yes' }}
92102
run: |
93103
cd testproject
94-
export FAKEREDIS=${{ matrix.fake-redis }}
104+
export FAKEREDIS=${{ matrix.broker == 'fakeredis' }}
105+
if [ ${{ matrix.broker == 'valkey' }} == true ]; then
106+
export BROKER_PORT=6380
107+
else
108+
export BROKER_PORT=6379
109+
fi
95110
poetry run python manage.py test scheduler
96111
97112
# Steps for coverage check
@@ -102,6 +117,7 @@ jobs:
102117
pythonVer: ${{ matrix.python-version }}
103118
djangoVer: ${{ matrix.django-version }}
104119
repoToken: ${{ secrets.GITHUB_TOKEN }}
120+
105121
- name: Create coverage badge
106122
if: ${{ matrix.coverage == 'yes' && github.event_name == 'push' }}
107123
uses: schneegans/[email protected]

scheduler/management/commands/rqworker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import click
66
from django.core.management.base import BaseCommand
77
from django.db import connections
8-
from django.template.defaultfilters import default
98
from redis.exceptions import ConnectionError
109
from rq.logutils import setup_loghandlers
1110

testproject/testproject/settings.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,23 @@
111111
# Static files (CSS, JavaScript, Images)
112112
# https://docs.djangoproject.com/en/1.9/howto/static-files/
113113

114+
BROKER_PORT = os.getenv("BROKER_PORT", "6379")
114115
STATIC_URL = "/static/"
115116
SCHEDULER_QUEUES = {
116117
"default": {
117-
"URL": "redis://localhost:6379/0",
118+
"URL": f"redis://localhost:${BROKER_PORT}/0",
118119
},
119120
"low": {
120-
"URL": "redis://localhost:6379/0",
121+
"URL": f"redis://localhost:${BROKER_PORT}/0",
121122
},
122123
"high": {
123-
"URL": "redis://localhost:6379/1",
124+
"URL": f"redis://localhost:${BROKER_PORT}/1",
124125
},
125126
"medium": {
126-
"URL": "redis://localhost:6379/1",
127+
"URL": f"redis://localhost:${BROKER_PORT}/1",
127128
},
128129
"another": {
129-
"URL": "redis://localhost:6379/1",
130+
"URL": f"redis://localhost:${BROKER_PORT}/1",
130131
},
131132
}
132133
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

0 commit comments

Comments
 (0)