Skip to content

Commit

Permalink
ci fix: fix data types changes in redis 7 (#470)
Browse files Browse the repository at this point in the history
* bugfix: decode escape for restore command

* bugfix escape for all args

* bugfix: only escape decode for restore command

* add a todo

* fix regex

* fix peek assert

* add command restore test

* ci fix: fix data types changes in redis 7

* bugfix list type

* black
  • Loading branch information
laixintao committed Sep 15, 2023
1 parent 7e4aaf9 commit 9b3c3d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
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

0 comments on commit 9b3c3d4

Please sign in to comment.