Skip to content

Commit 663a0d0

Browse files
committed
Change test infrastructure to CE instead of Stack
1 parent 7d73d74 commit 663a0d0

21 files changed

+40
-1566
lines changed

.github/workflows/integration.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ env:
2727
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2828
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
2929
COVERAGE_CORE: sysmon
30-
REDIS_IMAGE: redis:7.4-rc2
31-
REDIS_STACK_IMAGE: redis/redis-stack-server:latest
30+
REDIS_IMAGE: redis:8.0-M01
3231

3332
jobs:
3433
dependency-audit:

docker-compose.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: "3.8"
55
services:
66

77
redis:
8-
image: ${REDIS_IMAGE:-redis:latest}
8+
image: redis:8.0-M01
99
container_name: redis-standalone
1010
command: redis-server --enable-debug-command yes --protected-mode no
1111
ports:
@@ -17,7 +17,7 @@ services:
1717
- all
1818

1919
replica:
20-
image: ${REDIS_IMAGE:-redis:latest}
20+
image: redis:8.0-M01
2121
container_name: redis-replica
2222
depends_on:
2323
- redis
@@ -34,7 +34,7 @@ services:
3434
context: .
3535
dockerfile: dockers/Dockerfile.cluster
3636
args:
37-
REDIS_IMAGE: ${REDIS_IMAGE:-redis:latest}
37+
REDIS_IMAGE: redis:8.0-M01
3838
ports:
3939
- 16379:16379
4040
- 16380:16380
@@ -63,7 +63,7 @@ services:
6363
- "./dockers/stunnel/keys:/etc/stunnel/keys:ro"
6464

6565
sentinel:
66-
image: ${REDIS_IMAGE:-redis:latest}
66+
image: redis:8.0-M01
6767
container_name: redis-sentinel
6868
depends_on:
6969
- redis
@@ -77,7 +77,7 @@ services:
7777
- all
7878

7979
sentinel2:
80-
image: ${REDIS_IMAGE:-redis:latest}
80+
image: redis:8.0-M01
8181
container_name: redis-sentinel2
8282
depends_on:
8383
- redis
@@ -91,7 +91,7 @@ services:
9191
- all
9292

9393
sentinel3:
94-
image: ${REDIS_IMAGE:-redis:latest}
94+
image: redis:8.0-M01
9595
container_name: redis-sentinel3
9696
depends_on:
9797
- redis
@@ -104,17 +104,6 @@ services:
104104
- sentinel
105105
- all
106106

107-
redis-stack:
108-
image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:edge}
109-
container_name: redis-stack
110-
ports:
111-
- 6479:6379
112-
environment:
113-
- "REDIS_ARGS=--enable-debug-command yes --enable-module-command yes"
114-
profiles:
115-
- standalone
116-
- all
117-
118107
redis-stack-graph:
119108
image: redis/redis-stack-server:6.2.6-v15
120109
container_name: redis-stack-graph

redis/commands/search/commands.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ def _parse_profile(self, res, **kwargs):
101101
with_scores=query._with_scores,
102102
)
103103

104-
return result, parse_to_dict(res[1])
104+
docs = {}
105+
for i in range(0, len(res[1]), 2):
106+
if isinstance(res[1][i + 1], list):
107+
for item in res[1][i + 1]:
108+
res[1][i + 1] = parse_to_dict(item)
109+
110+
docs[res[1][i]] = res[1][i + 1]
111+
112+
return result, docs
105113

106114
def _parse_spellcheck(self, res, **kwargs):
107115
corrections = {}

tests/conftest.py

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
REDIS_INFO = {}
1919
default_redis_url = "redis://localhost:6379/0"
2020
default_protocol = "2"
21-
default_redismod_url = "redis://localhost:6479"
2221

2322
# default ssl client ignores verification for the purpose of testing
2423
default_redis_ssl_url = "rediss://localhost:6666"
@@ -159,30 +158,23 @@ def pytest_sessionstart(session):
159158
arch_bits = info["arch_bits"]
160159
cluster_enabled = info["cluster_enabled"]
161160
enterprise = info["enterprise"]
161+
modules = info["modules"]
162162
except redis.ConnectionError:
163163
# provide optimistic defaults
164164
info = {}
165165
version = "10.0.0"
166166
arch_bits = 64
167167
cluster_enabled = False
168168
enterprise = False
169+
modules = {}
169170
REDIS_INFO["version"] = version
170171
REDIS_INFO["arch_bits"] = arch_bits
171172
REDIS_INFO["cluster_enabled"] = cluster_enabled
172173
REDIS_INFO["enterprise"] = enterprise
174+
REDIS_INFO["modules"] = modules
173175
# store REDIS_INFO in config so that it is available from "condition strings"
174176
session.config.REDIS_INFO = REDIS_INFO
175177

176-
# module info
177-
stack_url = redis_url
178-
if stack_url == default_redis_url:
179-
stack_url = default_redismod_url
180-
try:
181-
stack_info = _get_info(stack_url)
182-
REDIS_INFO["modules"] = stack_info["modules"]
183-
except (KeyError, redis.exceptions.ConnectionError):
184-
pass
185-
186178
if cluster_enabled:
187179
cluster_nodes = session.config.getoption("--redis-cluster-nodes")
188180
wait_for_cluster_creation(redis_url, cluster_nodes)
@@ -369,21 +361,6 @@ def r(request):
369361
yield client
370362

371363

372-
@pytest.fixture()
373-
def stack_url(request):
374-
stack_url = request.config.getoption("--redis-url", default=default_redismod_url)
375-
if stack_url == default_redis_url:
376-
return default_redismod_url
377-
else:
378-
return stack_url
379-
380-
381-
@pytest.fixture()
382-
def stack_r(request, stack_url):
383-
with _get_client(redis.Redis, request, from_url=stack_url) as client:
384-
yield client
385-
386-
387364
@pytest.fixture()
388365
def decoded_r(request):
389366
with _get_client(redis.Redis, request, decode_responses=True) as client:

tests/test_asyncio/test_bloom.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212

1313

1414
@pytest_asyncio.fixture()
15-
async def decoded_r(create_redis, stack_url):
16-
return await create_redis(decode_responses=True, url=stack_url)
15+
async def decoded_r(create_redis):
16+
return await create_redis(decode_responses=True)
1717

1818

1919
def intlist(obj):
2020
return [int(v) for v in obj]
2121

2222

23-
@pytest.mark.redismod
2423
async def test_create(decoded_r: redis.Redis):
2524
"""Test CREATE/RESERVE calls"""
2625
assert await decoded_r.bf().create("bloom", 0.01, 1000)
@@ -36,12 +35,10 @@ async def test_create(decoded_r: redis.Redis):
3635

3736

3837
@pytest.mark.experimental
39-
@pytest.mark.redismod
4038
async def test_tdigest_create(decoded_r: redis.Redis):
4139
assert await decoded_r.tdigest().create("tDigest", 100)
4240

4341

44-
@pytest.mark.redismod
4542
async def test_bf_add(decoded_r: redis.Redis):
4643
assert await decoded_r.bf().create("bloom", 0.01, 1000)
4744
assert 1 == await decoded_r.bf().add("bloom", "foo")
@@ -54,7 +51,6 @@ async def test_bf_add(decoded_r: redis.Redis):
5451
assert [1, 0] == intlist(await decoded_r.bf().mexists("bloom", "foo", "noexist"))
5552

5653

57-
@pytest.mark.redismod
5854
async def test_bf_insert(decoded_r: redis.Redis):
5955
assert await decoded_r.bf().create("bloom", 0.01, 1000)
6056
assert [1] == intlist(await decoded_r.bf().insert("bloom", ["foo"]))
@@ -85,7 +81,6 @@ async def test_bf_insert(decoded_r: redis.Redis):
8581
)
8682

8783

88-
@pytest.mark.redismod
8984
async def test_bf_scandump_and_loadchunk(decoded_r: redis.Redis):
9085
# Store a filter
9186
await decoded_r.bf().create("myBloom", "0.0001", "1000")
@@ -133,7 +128,6 @@ async def do_verify():
133128
await decoded_r.bf().create("myBloom", "0.0001", "10000000")
134129

135130

136-
@pytest.mark.redismod
137131
async def test_bf_info(decoded_r: redis.Redis):
138132
expansion = 4
139133
# Store a filter
@@ -165,7 +159,6 @@ async def test_bf_info(decoded_r: redis.Redis):
165159
assert True
166160

167161

168-
@pytest.mark.redismod
169162
async def test_bf_card(decoded_r: redis.Redis):
170163
# return 0 if the key does not exist
171164
assert await decoded_r.bf().card("not_exist") == 0
@@ -180,7 +173,6 @@ async def test_bf_card(decoded_r: redis.Redis):
180173
await decoded_r.bf().card("setKey")
181174

182175

183-
@pytest.mark.redismod
184176
async def test_cf_add_and_insert(decoded_r: redis.Redis):
185177
assert await decoded_r.cf().create("cuckoo", 1000)
186178
assert await decoded_r.cf().add("cuckoo", "filter")
@@ -206,7 +198,6 @@ async def test_cf_add_and_insert(decoded_r: redis.Redis):
206198
)
207199

208200

209-
@pytest.mark.redismod
210201
async def test_cf_exists_and_del(decoded_r: redis.Redis):
211202
assert await decoded_r.cf().create("cuckoo", 1000)
212203
assert await decoded_r.cf().add("cuckoo", "filter")
@@ -218,7 +209,6 @@ async def test_cf_exists_and_del(decoded_r: redis.Redis):
218209
assert 0 == await decoded_r.cf().count("cuckoo", "filter")
219210

220211

221-
@pytest.mark.redismod
222212
async def test_cms(decoded_r: redis.Redis):
223213
assert await decoded_r.cms().initbydim("dim", 1000, 5)
224214
assert await decoded_r.cms().initbyprob("prob", 0.01, 0.01)
@@ -235,7 +225,6 @@ async def test_cms(decoded_r: redis.Redis):
235225

236226

237227
@pytest.mark.onlynoncluster
238-
@pytest.mark.redismod
239228
async def test_cms_merge(decoded_r: redis.Redis):
240229
assert await decoded_r.cms().initbydim("A", 1000, 5)
241230
assert await decoded_r.cms().initbydim("B", 1000, 5)
@@ -252,7 +241,6 @@ async def test_cms_merge(decoded_r: redis.Redis):
252241
assert [16, 15, 21] == await decoded_r.cms().query("C", "foo", "bar", "baz")
253242

254243

255-
@pytest.mark.redismod
256244
async def test_topk(decoded_r: redis.Redis):
257245
# test list with empty buckets
258246
assert await decoded_r.topk().reserve("topk", 3, 50, 4, 0.9)
@@ -333,7 +321,6 @@ async def test_topk(decoded_r: redis.Redis):
333321
assert 0.9 == round(float(info["decay"]), 1)
334322

335323

336-
@pytest.mark.redismod
337324
async def test_topk_incrby(decoded_r: redis.Redis):
338325
await decoded_r.flushdb()
339326
assert await decoded_r.topk().reserve("topk", 3, 10, 3, 1)
@@ -349,7 +336,6 @@ async def test_topk_incrby(decoded_r: redis.Redis):
349336

350337

351338
@pytest.mark.experimental
352-
@pytest.mark.redismod
353339
async def test_tdigest_reset(decoded_r: redis.Redis):
354340
assert await decoded_r.tdigest().create("tDigest", 10)
355341
# reset on empty histogram
@@ -366,7 +352,6 @@ async def test_tdigest_reset(decoded_r: redis.Redis):
366352

367353

368354
@pytest.mark.onlynoncluster
369-
@pytest.mark.redismod
370355
async def test_tdigest_merge(decoded_r: redis.Redis):
371356
assert await decoded_r.tdigest().create("to-tDigest", 10)
372357
assert await decoded_r.tdigest().create("from-tDigest", 10)
@@ -394,7 +379,6 @@ async def test_tdigest_merge(decoded_r: redis.Redis):
394379

395380

396381
@pytest.mark.experimental
397-
@pytest.mark.redismod
398382
async def test_tdigest_min_and_max(decoded_r: redis.Redis):
399383
assert await decoded_r.tdigest().create("tDigest", 100)
400384
# insert data-points into sketch
@@ -405,7 +389,6 @@ async def test_tdigest_min_and_max(decoded_r: redis.Redis):
405389

406390

407391
@pytest.mark.experimental
408-
@pytest.mark.redismod
409392
@skip_ifmodversion_lt("2.4.0", "bf")
410393
async def test_tdigest_quantile(decoded_r: redis.Redis):
411394
assert await decoded_r.tdigest().create("tDigest", 500)
@@ -434,7 +417,6 @@ async def test_tdigest_quantile(decoded_r: redis.Redis):
434417

435418

436419
@pytest.mark.experimental
437-
@pytest.mark.redismod
438420
async def test_tdigest_cdf(decoded_r: redis.Redis):
439421
assert await decoded_r.tdigest().create("tDigest", 100)
440422
# insert data-points into sketch
@@ -446,7 +428,6 @@ async def test_tdigest_cdf(decoded_r: redis.Redis):
446428

447429

448430
@pytest.mark.experimental
449-
@pytest.mark.redismod
450431
@skip_ifmodversion_lt("2.4.0", "bf")
451432
async def test_tdigest_trimmed_mean(decoded_r: redis.Redis):
452433
assert await decoded_r.tdigest().create("tDigest", 100)
@@ -457,7 +438,6 @@ async def test_tdigest_trimmed_mean(decoded_r: redis.Redis):
457438

458439

459440
@pytest.mark.experimental
460-
@pytest.mark.redismod
461441
async def test_tdigest_rank(decoded_r: redis.Redis):
462442
assert await decoded_r.tdigest().create("t-digest", 500)
463443
assert await decoded_r.tdigest().add("t-digest", list(range(0, 20)))
@@ -468,7 +448,6 @@ async def test_tdigest_rank(decoded_r: redis.Redis):
468448

469449

470450
@pytest.mark.experimental
471-
@pytest.mark.redismod
472451
async def test_tdigest_revrank(decoded_r: redis.Redis):
473452
assert await decoded_r.tdigest().create("t-digest", 500)
474453
assert await decoded_r.tdigest().add("t-digest", list(range(0, 20)))
@@ -478,7 +457,6 @@ async def test_tdigest_revrank(decoded_r: redis.Redis):
478457

479458

480459
@pytest.mark.experimental
481-
@pytest.mark.redismod
482460
async def test_tdigest_byrank(decoded_r: redis.Redis):
483461
assert await decoded_r.tdigest().create("t-digest", 500)
484462
assert await decoded_r.tdigest().add("t-digest", list(range(1, 11)))
@@ -490,7 +468,6 @@ async def test_tdigest_byrank(decoded_r: redis.Redis):
490468

491469

492470
@pytest.mark.experimental
493-
@pytest.mark.redismod
494471
async def test_tdigest_byrevrank(decoded_r: redis.Redis):
495472
assert await decoded_r.tdigest().create("t-digest", 500)
496473
assert await decoded_r.tdigest().add("t-digest", list(range(1, 11)))

tests/test_asyncio/test_connection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ async def get_conn(_):
9696

9797

9898
@skip_if_server_version_lt("4.0.0")
99-
@pytest.mark.redismod
10099
@pytest.mark.onlynoncluster
101100
async def test_loading_external_modules(r):
102101
def inner():

0 commit comments

Comments
 (0)