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

Python: add RANDOMKEY command #396

Merged

Conversation

aaron-congo
Copy link

@aaron-congo aaron-congo commented Jun 27, 2024

  • also updates the redis-rs module to point to the latest commit in redis-rs/main

@@ -285,7 +285,7 @@ impl StandaloneClient {
Some(ResponsePolicy::OneSucceeded) => future::select_ok(requests.map(Box::pin))
.await
.map(|(result, _)| result),
Some(ResponsePolicy::OneSucceededNonEmpty) => {
Some(ResponsePolicy::FirstSucceededNonEmptyOrAllEmpty) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was renamed in redis-rs, so I had to rename here to get the Rust code to build successfully

@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])
async def test_random_key(self, redis_client: TGlideClient):
async def test_cluster_client_random_key(self, redis_client: TGlideClient):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async def test_cluster_client_random_key(self, redis_client: TGlideClient):
async def test_cluster_client_random_key(self, redis_client: GlideClusterClient):

And you can remove assert for client type then

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will address all of these when I push to upstream

key = get_random_string(10)

# set a key in the database in case it was empty
# setup: delete all keys
assert isinstance(redis_client, GlideClusterClient)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert isinstance(redis_client, GlideClusterClient)

assert await redis_client.exists([result]) == 1
@pytest.mark.parametrize("cluster_mode", [False])
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])
async def test_standalone_client_random_key(self, redis_client: TGlideClient):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same in this test

@aaron-congo aaron-congo merged commit 7be3995 into python/integ_acongo_randomkey Jun 27, 2024
44 checks passed
@aaron-congo aaron-congo deleted the python/dev_acongo_randomkey branch June 27, 2024 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants