-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat: support Elasticache cluster mode by setting IsClusterMode in config #3255
base: master
Are you sure you want to change the base?
Conversation
reeshijoshi
commented
Jan 29, 2025
- This is required because Elasticache supports setting up cluster mode with configuration endpoint. So the check len(Addrs) > 1 is not enough for determining cluster mode.
- If IsClusterMode is true, the client will be created as a cluster client.
@reeshijoshi thank you for the contribution. Would you be able to add tests for this new option? |
This needs an Elasticache configuration endpoint to be provided in the Addrs field. I can add a unit test with one address only in this but that's not representative of how this would behave in the actual scenario |
874d360
to
5cfd564
Compare
Added a test that asserts client type |
5cfd564
to
5706167
Compare
@vladvildanov I think this one is good to be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reeshijoshi Overall looks good to me, would you mind changing the comment as suggested or anything starting with the IsClusterMode
as suggested in https://tip.golang.org/doc/comment
5706167
to
cf4e8a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks @reeshijoshi
@@ -38,4 +38,13 @@ var _ = Describe("UniversalClient", func() { | |||
}) | |||
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred()) | |||
}) | |||
|
|||
It("should connect to clusters if IsClusterMode is set even if only a single address is provided", Label("NonRedisEnterprise"), func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndyakov This test is an integration test, right? So we basically test if handshake had happened and it's possible to connect to cluster via single endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reeshijoshi , what Vlad said is valid. Let's check if the cluster slots
response includes all slots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndyakov I think this should only be a test for whether setting IsClusterMode: true
actually returns an instance of ClusterClient. I don't think verifying whether all the connectivity is setup correctly should be in the scope of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this will test is if the cluster client is working properly with a single endpoint. It can be in a separate place, but let’s add such test before including the possibility of initiating cluster client with single endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndyakov apologies I've been away on a vacation. I've pushed a a new test checking length of cluster slots. Let me know if this solves it!
cf4e8a0
to
24c3d51
Compare
@reeshijoshi would you please add additional test so we can merge this? |
d0373b9
to
8dbeb49
Compare
done |
8dbeb49
to
0c8901e
Compare