-
Notifications
You must be signed in to change notification settings - Fork 53
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
Fetch server version using info command #2258
Fetch server version using info command #2258
Conversation
Signed-off-by: Prateek Kumar <[email protected]>
Signed-off-by: Prateek Kumar <[email protected]>
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.
You probably need to run linter before commit
String[] serverSectionArray = infoResponse.split("\n"); | ||
|
||
for (int i = 0; i < serverSectionArray.length; i++) { | ||
if (serverSectionArray[i].contains("redis_version")) { |
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.
Check for valkey version first
127.0.0.1:7000> info server
# Server
redis_version:7.2.4
server_name:valkey
valkey_version:7.9.240
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.
Updated.
} | ||
|
||
} catch (Exception e) { | ||
throw new RuntimeException(e); |
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.
Add a message, e.g. "failed to get server version"
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.
Updated.
|
||
static { | ||
try { | ||
standaloneClient = GlideClient.createClient(commonClientConfig().build()).get(); |
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.
standaloneClient = GlideClient.createClient(commonClientConfig().build()).get(); | |
var standaloneClient = GlideClient.createClient(commonClientConfig().build()).get(); |
No need static lifetime for the client
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.
Updated.
private static final GlideClient standaloneClient; | ||
public static final Semver SERVER_VERSION; | ||
|
||
static { |
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.
Please add a function to TestUtilities
which runs info
and parses the response. The function has one argument - client.
Then static block will call that function. Add @SneakyThrows
to the function - we don't care about exceptions.
This could be used in some specific tests where we could have servers of different versions.
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.
Updated.
Moved function to TestUtilities.
Signed-off-by: Prateek Kumar <[email protected]>
Signed-off-by: Prateek Kumar <[email protected]>
Updated. Used these 2 commands for linter check |
Signed-off-by: prateek-kumar-improving <[email protected]>
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.
Please clean up gradle script now
Signed-off-by: prateek-kumar-improving <[email protected]>
Creating a separate PR for this. |
* Fetch server version using info command Signed-off-by: Prateek Kumar <[email protected]>
Get server version using info command in TestConfiguration.java