mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
7aa3dba423
* chore: use decode_responses when creating a redis client --------- Signed-off-by: Roman Gershman <roman@dragonflydb.io>
25 lines
1 KiB
Python
25 lines
1 KiB
Python
import pytest
|
|
import redis
|
|
from redis.asyncio import Redis as RedisClient
|
|
from .utility import *
|
|
from .instance import DflyStartException
|
|
|
|
|
|
async def test_maxclients(df_factory):
|
|
# Needs some authentication
|
|
with df_factory.create(port=1111, maxclients=1, admin_port=1112) as server:
|
|
async with server.client() as client1:
|
|
assert ["maxclients", "1"] == await client1.execute_command("CONFIG GET maxclients")
|
|
|
|
with pytest.raises(redis.exceptions.ConnectionError):
|
|
async with server.client() as client2:
|
|
await client2.get("test")
|
|
|
|
# Check that admin connections are not limited.
|
|
async with RedisClient(port=server.admin_port) as admin_client:
|
|
await admin_client.get("test")
|
|
|
|
await client1.execute_command("CONFIG SET maxclients 3")
|
|
assert ["maxclients", "3"] == await client1.execute_command("CONFIG GET maxclients")
|
|
async with server.client() as client2:
|
|
await client2.get("test")
|