Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change test infrastructure to CE instead of Stack #3383

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
COVERAGE_CORE: sysmon
REDIS_IMAGE: redis:7.4-rc2
REDIS_STACK_IMAGE: redis/redis-stack-server:latest
REDIS_IMAGE: redis:8.0-M01

jobs:
dependency-audit:
Expand Down
11 changes: 0 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,6 @@ services:
- sentinel
- all

redis-stack:
image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:edge}
container_name: redis-stack
ports:
- 6479:6379
environment:
- "REDIS_ARGS=--enable-debug-command yes --enable-module-command yes"
profiles:
- standalone
- all

redis-stack-graph:
image: redis/redis-stack-server:6.2.6-v15
container_name: redis-stack-graph
Expand Down
29 changes: 3 additions & 26 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
REDIS_INFO = {}
default_redis_url = "redis://localhost:6379/0"
default_protocol = "2"
default_redismod_url = "redis://localhost:6479"

# default ssl client ignores verification for the purpose of testing
default_redis_ssl_url = "rediss://localhost:6666"
Expand Down Expand Up @@ -159,30 +158,23 @@ def pytest_sessionstart(session):
arch_bits = info["arch_bits"]
cluster_enabled = info["cluster_enabled"]
enterprise = info["enterprise"]
modules = info["modules"]
except redis.ConnectionError:
# provide optimistic defaults
info = {}
version = "10.0.0"
arch_bits = 64
cluster_enabled = False
enterprise = False
modules = {}
REDIS_INFO["version"] = version
REDIS_INFO["arch_bits"] = arch_bits
REDIS_INFO["cluster_enabled"] = cluster_enabled
REDIS_INFO["enterprise"] = enterprise
REDIS_INFO["modules"] = modules
# store REDIS_INFO in config so that it is available from "condition strings"
session.config.REDIS_INFO = REDIS_INFO

# module info
stack_url = redis_url
if stack_url == default_redis_url:
stack_url = default_redismod_url
try:
stack_info = _get_info(stack_url)
REDIS_INFO["modules"] = stack_info["modules"]
except (KeyError, redis.exceptions.ConnectionError):
pass

if cluster_enabled:
cluster_nodes = session.config.getoption("--redis-cluster-nodes")
wait_for_cluster_creation(redis_url, cluster_nodes)
Expand Down Expand Up @@ -369,21 +361,6 @@ def r(request):
yield client


@pytest.fixture()
def stack_url(request):
stack_url = request.config.getoption("--redis-url", default=default_redismod_url)
if stack_url == default_redis_url:
return default_redismod_url
else:
return stack_url


@pytest.fixture()
def stack_r(request, stack_url):
with _get_client(redis.Redis, request, from_url=stack_url) as client:
yield client


@pytest.fixture()
def decoded_r(request):
with _get_client(redis.Redis, request, decode_responses=True) as client:
Expand Down
27 changes: 2 additions & 25 deletions tests/test_asyncio/test_bloom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@


@pytest_asyncio.fixture()
async def decoded_r(create_redis, stack_url):
return await create_redis(decode_responses=True, url=stack_url)
async def decoded_r(create_redis):
return await create_redis(decode_responses=True)


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


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


@pytest.mark.experimental
@pytest.mark.redismod
async def test_tdigest_create(decoded_r: redis.Redis):
assert await decoded_r.tdigest().create("tDigest", 100)


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


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


@pytest.mark.redismod
async def test_bf_scandump_and_loadchunk(decoded_r: redis.Redis):
# Store a filter
await decoded_r.bf().create("myBloom", "0.0001", "1000")
Expand Down Expand Up @@ -133,7 +128,6 @@ async def do_verify():
await decoded_r.bf().create("myBloom", "0.0001", "10000000")


@pytest.mark.redismod
async def test_bf_info(decoded_r: redis.Redis):
expansion = 4
# Store a filter
Expand Down Expand Up @@ -165,7 +159,6 @@ async def test_bf_info(decoded_r: redis.Redis):
assert True


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


@pytest.mark.redismod
async def test_cf_add_and_insert(decoded_r: redis.Redis):
assert await decoded_r.cf().create("cuckoo", 1000)
assert await decoded_r.cf().add("cuckoo", "filter")
Expand All @@ -206,7 +198,6 @@ async def test_cf_add_and_insert(decoded_r: redis.Redis):
)


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


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


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


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


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


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


@pytest.mark.onlynoncluster
@pytest.mark.redismod
async def test_tdigest_merge(decoded_r: redis.Redis):
assert await decoded_r.tdigest().create("to-tDigest", 10)
assert await decoded_r.tdigest().create("from-tDigest", 10)
Expand Down Expand Up @@ -394,7 +379,6 @@ async def test_tdigest_merge(decoded_r: redis.Redis):


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


@pytest.mark.experimental
@pytest.mark.redismod
@skip_ifmodversion_lt("2.4.0", "bf")
async def test_tdigest_quantile(decoded_r: redis.Redis):
assert await decoded_r.tdigest().create("tDigest", 500)
Expand Down Expand Up @@ -434,7 +417,6 @@ async def test_tdigest_quantile(decoded_r: redis.Redis):


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


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


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


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


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


@pytest.mark.experimental
@pytest.mark.redismod
async def test_tdigest_byrevrank(decoded_r: redis.Redis):
assert await decoded_r.tdigest().create("t-digest", 500)
assert await decoded_r.tdigest().add("t-digest", list(range(1, 11)))
Expand Down
1 change: 0 additions & 1 deletion tests/test_asyncio/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ async def get_conn(_):


@skip_if_server_version_lt("4.0.0")
@pytest.mark.redismod
@pytest.mark.onlynoncluster
async def test_loading_external_modules(r):
def inner():
Expand Down
Loading
Loading