diff --git a/tests/cli_tests/test_pager.py b/tests/cli_tests/test_pager.py index 38ced311..5a285a81 100644 --- a/tests/cli_tests/test_pager.py +++ b/tests/cli_tests/test_pager.py @@ -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) diff --git a/tests/unittests/test_client.py b/tests/unittests/test_client.py index b156d7c1..77a48de8 100644 --- a/tests/unittests/test_client.py +++ b/tests/unittests/test_client.py @@ -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( @@ -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"), @@ -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):