Skip to content

Conversation

@hank95179
Copy link
Contributor

Issue link

This Pull Request is linked to issue (URL): #4952

Description

This PR addresses the flakiness observed in test_zscan and test_sync_zscan.
The test seeds the database with two sets of data: a char_map (keys: 'a', 'b', 'c'...) and a large num_map (keys: 'value 0', 'value 1'...).
The previous assertion strictly required all items returned by zscan to start with "value". However, since zscan iterates through the set, it occasionally returns items from the char_map. When this happened, the strict assertion caused the test to fail incorrectly.

Solution

Updated the assertion logic in both tests/async_tests/test_async_client.py and tests/sync_tests/test_sync_client.py.

  • Defined a valid_char_keys set containing the expected char_map keys.
  • Modified the assertion to accept items that either start with "value" OR are present in valid_char_keys.

Verification

@hank95179 hank95179 requested a review from a team as a code owner December 12, 2025 08:15
@hank95179 hank95179 force-pushed the fix-issue-4952-zscan branch from d60c10e to 105ae47 Compare December 12, 2025 08:45
@xShinnRyuu
Copy link
Collaborator

Thanks for contributing. I will review the PR and give it a test to see if the fix is appropriate.

@xShinnRyuu
Copy link
Collaborator

@hank95179 Similar to your node fix I believe the better solution is to add a match="value*" to the zscan parameters rather than changing the set it returns.

if not await check_if_server_version_lt(glide_client, "8.0.0"):
            result = await glide_client.zscan(
                key1, initial_cursor, match="value*", no_scores=True // Added match="value*"
            )
            assert result[result_cursor_index] != b"0"
            values_array = cast(List[bytes], result[result_collection_index])
            # Verify that scores are not included
            assert all(
                item.startswith(b"value") and item.isascii() for item in values_array
            )

Please revise.

@xShinnRyuu
Copy link
Collaborator

Hi @hank95179,

This PR has been open with outstanding feedback. If you could address the comments within the next couple of days, that would be great. Otherwise, I’ll plan to take over the PR and address the issue it was intended to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants