Skip to content

Commit

Permalink
ci fix: fix data types changes in redis 7
Browse files Browse the repository at this point in the history
  • Loading branch information
laixintao committed Sep 15, 2023
1 parent be57376 commit 190a3b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion tests/cli_tests/test_pager.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ def test_using_pager_works_for_help():
child.expect("Set the string value of a key")
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
6 changes: 4 additions & 2 deletions tests/unittests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def completer():


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


@pytest.mark.parametrize(
Expand Down Expand Up @@ -303,7 +305,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 \({zset_type}\) mem: \d+ bytes, ttl: -1"),
("", "\n"),
("class:dockey", "llen: "),
("", "5"),
Expand Down Expand Up @@ -351,7 +353,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

0 comments on commit 190a3b5

Please sign in to comment.