Merging upstream version 1.14.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
455e66126a
commit
cd1500a24a
19 changed files with 152 additions and 114 deletions
|
@ -1,6 +1,8 @@
|
|||
from textwrap import dedent
|
||||
|
||||
from packaging.version import parse as version_parse # noqa: F401
|
||||
import pexpect
|
||||
import pytest
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
def test_start_on_connection_error():
|
||||
|
@ -29,14 +31,14 @@ def test_short_help_option(config):
|
|||
c.close()
|
||||
|
||||
|
||||
@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) != 5")
|
||||
@pytest.mark.skipif("version_parse(os.environ['REDIS_VERSION']) != version_parse('5')")
|
||||
def test_server_version_in_starting_on5():
|
||||
c = pexpect.spawn("iredis", timeout=2)
|
||||
c.expect("redis-server 5")
|
||||
c.close()
|
||||
|
||||
|
||||
@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) != 6")
|
||||
@pytest.mark.skipif("version_parse(os.environ['REDIS_VERSION']) != version_parse('6')")
|
||||
def test_server_version_in_starting_on6():
|
||||
c = pexpect.spawn("iredis", timeout=2)
|
||||
c.expect("redis-server 6")
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import os
|
||||
|
||||
from packaging.version import parse as version_parse
|
||||
import pytest
|
||||
|
||||
|
||||
|
@ -9,7 +11,7 @@ def test_wrong_select_db_index(cli):
|
|||
cli.sendline("select 128")
|
||||
cli.expect(["DB index is out of range", "127.0.0.1:6379[1]>"])
|
||||
|
||||
if int(os.environ["REDIS_VERSION"]) > 5:
|
||||
if version_parse(os.environ["REDIS_VERSION"]) > version_parse("5"):
|
||||
text = "value is not an integer or out of range"
|
||||
else:
|
||||
text = "invalid DB index"
|
||||
|
@ -42,14 +44,14 @@ def test_enter_key_binding(clean_redis, cli):
|
|||
cli.expect(r"hello")
|
||||
|
||||
|
||||
@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) < 6")
|
||||
@pytest.mark.skipif("version_parse(os.environ['REDIS_VERSION']) < version_parse('6')")
|
||||
def test_auth_hidden_password_with_username(clean_redis, cli):
|
||||
cli.send("auth default hello-world")
|
||||
cli.expect("default")
|
||||
cli.expect(r"\*{11}")
|
||||
|
||||
|
||||
@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) > 5")
|
||||
@pytest.mark.skipif("version_parse(os.environ['REDIS_VERSION']) > version_parse('5')")
|
||||
def test_auth_hidden_password(clean_redis, cli):
|
||||
cli.send("auth hello-world")
|
||||
cli.expect("auth")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from packaging.version import parse as version_parse # noqa: F401
|
||||
import pytest
|
||||
|
||||
|
||||
|
@ -37,7 +38,7 @@ def test_command_completion_when_space_command(cli, clean_redis):
|
|||
cli.expect("command info")
|
||||
|
||||
|
||||
@pytest.mark.skipif("int(os.environ['REDIS_VERSION']) < 6")
|
||||
@pytest.mark.skipif("version_parse(os.environ['REDIS_VERSION']) < version_parse('6')")
|
||||
def test_username_completer(cli, iredis_client):
|
||||
iredis_client.execute("acl setuser", "foo1")
|
||||
iredis_client.execute("acl setuser", "bar2")
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
# noqa: F541
|
||||
import os
|
||||
import sys
|
||||
import pexpect
|
||||
import pathlib
|
||||
from contextlib import contextmanager
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
from textwrap import dedent
|
||||
from packaging.version import parse as version_parse
|
||||
|
||||
import pexpect
|
||||
|
||||
|
||||
TEST_IREDISRC = "/tmp/.iredisrc.test"
|
||||
|
@ -22,6 +24,10 @@ env_pager_numbers = "{0} {1} {2}".format(
|
|||
TEST_PAGER_BOUNDARY_NUMBER,
|
||||
)
|
||||
|
||||
long_list_type = "quicklist"
|
||||
if version_parse(os.environ["REDIS_VERSION"]) >= version_parse("7"):
|
||||
long_list_type = "listpack"
|
||||
|
||||
|
||||
@contextmanager
|
||||
def pager_enabled_cli():
|
||||
|
@ -54,11 +60,6 @@ def test_using_pager_works_for_help():
|
|||
child.expect(TEST_PAGER_BOUNDARY)
|
||||
|
||||
|
||||
long_list_type = "quicklist"
|
||||
if os.environ["REDIS_VERSION"] == "7":
|
||||
long_list_type = "listpack"
|
||||
|
||||
|
||||
def test_pager_works_for_peek(clean_redis):
|
||||
for index in range(100):
|
||||
clean_redis.lpush("long-list", f"value-{index}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue