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

ci fix: fix data types changes in redis 7 #470

Merged
merged 10 commits into from
Sep 15, 2023
Merged
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
7 changes: 6 additions & 1 deletion tests/cli_tests/test_pager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ 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}")
with pager_enabled_cli() as child:
child.sendline("peek long-list")
child.expect(TEST_PAGER_BOUNDARY)
child.expect("(quicklist)")
child.expect(f"({long_list_type})")
child.expect("value-1")
child.expect(TEST_PAGER_BOUNDARY)

Expand Down
8 changes: 6 additions & 2 deletions tests/unittests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ def completer():


zset_type = "ziplist"
hash_type = "hashtable"
list_type = "quicklist"
if os.environ["REDIS_VERSION"] == "7":
zset_type = "listpack"
hash_type = "listpack"
list_type = "listpack"


@pytest.mark.parametrize(
Expand Down Expand Up @@ -303,7 +307,7 @@ def test_peek_list_fetch_all(iredis_client, clean_redis):
FormattedText(
[
("class:dockey", "key: "),
("", r"list \(quicklist\) mem: \d+ bytes, ttl: -1"),
("", rf"list \({list_type}\) mem: \d+ bytes, ttl: -1"),
("", "\n"),
("class:dockey", "llen: "),
("", "5"),
Expand Down Expand Up @@ -351,7 +355,7 @@ def test_peek_set_fetch_part(iredis_client, clean_redis):
peek_result = list(iredis_client.do_peek("myset"))

assert peek_result[0][0] == ("class:dockey", "key: ")
assert peek_result[0][1][1].startswith("set (hashtable) mem: ")
assert peek_result[0][1][1].startswith(f"set ({hash_type}) mem: ")


def test_peek_zset_fetch_all(iredis_client, clean_redis):
Expand Down
Loading