Skip to content

Commit

Permalink
Add valkey to CI/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaifee committed Apr 20, 2024
1 parent 0179c65 commit da2889a
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,7 @@ services:
- '11379:6379'
ulimits:
memlock: -1
valkey:
image: "valkey/valkey:${VALKEY_VERSION:-unstable}"
ports:
- '12379:6379'
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ markers =
dragonfly
sentinel
stack
valkey
ssl
uds
nocluster
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async def teardown(client):
"redis_cluster_blocking",
"redis_cluster_raw",
"keydb",
"valkey",
)
@pytest.mark.min_server_version("6.0.0")
class TestACL:
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_bitmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"redis_cluster_blocking",
"redis_cluster_raw",
"keydb",
"valkey",
)
class TestBitmap:
async def test_bitcount(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ async def simple_library(client):
"redis_cluster_blocking",
"redis_cluster_raw",
"keydb",
"valkey",
)
@pytest.mark.min_server_version("7.0.0")
class TestFunctions:
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"redis_cached_resp2",
"redis_cluster_cached",
"keydb",
"valkey",
)
class TestGeneric:
async def test_sort_basic(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"redis_cluster_blocking",
"redis_cluster_raw",
"keydb",
"valkey",
)
class TestGeo:
async def test_geoadd(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"redis_cluster_cached",
"keydb",
"dragonfly",
"valkey",
)
class TestHash:
async def test_hget_and_hset(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_hyperloglog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"redis_cluster_blocking",
"redis_cluster_raw",
"keydb",
"valkey",
)
class TestHyperLogLog:
async def test_pfadd(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"redis_cluster_cached",
"keydb",
"dragonfly",
"valkey",
)
class TestList:
async def test_blpop(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"redis_cluster_cached",
"keydb",
"dragonfly",
"valkey",
)
class TestSet:
async def test_sadd(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_sorted_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"redis_cluster_cached",
"keydb",
"dragonfly",
"valkey",
)
class TestSortedSet:
async def test_zadd(self, client, _s):
Expand Down
1 change: 1 addition & 0 deletions tests/commands/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async def get_stream_message(client, stream, message_id):
"redis_cluster_blocking",
"redis_cluster_raw",
"keydb",
"valkey",
)
class TestStreams:
async def test_xadd_with_wrong_id(self, client, _s):
Expand Down
2 changes: 2 additions & 0 deletions tests/commands/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"keydb",
"keydb_resp2",
"dragonfly",
"valkey",
"redict",
)
class TestString:
async def test_append(self, client, _s):
Expand Down
29 changes: 29 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@ def dragonfly_server(docker_services):
yield ["localhost", 11379]


@pytest.fixture(scope="session")
def valkey_server(docker_services):
docker_services.start("valkey")
docker_services.wait_for_service("valkey", 6379, ping_socket)
yield ["localhost", 12379]


@pytest.fixture(scope="session")
def keydb_cluster_server(docker_services):
docker_services.start("keydb-cluster-init")
Expand Down Expand Up @@ -1205,6 +1212,22 @@ async def dragonfly(dragonfly_server, request):
client.connection_pool.disconnect()


@pytest.fixture
async def valkey(valkey_server, request):
client = coredis.Redis(
"localhost",
12379,
decode_responses=True,
**get_client_test_args(request),
)
await client.flushall()
await set_default_test_config(client, variant="valkey")

yield client

client.connection_pool.disconnect()


@pytest.fixture(scope="session")
def docker_services_project_name():
return "coredis"
Expand Down Expand Up @@ -1328,5 +1351,11 @@ def pytest_collection_modifyitems(items):
item.add_marker(getattr(pytest.mark, "dragonfly"))
tokens = client_name.replace("dragonfly_", "").split("_")

for token in tokens:
item.add_marker(getattr(pytest.mark, token))
elif client_name.startswith("valkey"):
item.add_marker(getattr(pytest.mark, "valkey"))
tokens = client_name.replace("valkey_", "").split("_")

for token in tokens:
item.add_marker(getattr(pytest.mark, token))

0 comments on commit da2889a

Please sign in to comment.