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

fix: ping return bulk string #933

Merged
merged 9 commits into from
Oct 4, 2022

Conversation

ColinChamber
Copy link
Contributor

@ColinChamber ColinChamber commented Sep 29, 2022

This closes #926.

src/redis_cmd.cc Outdated Show resolved Hide resolved
require.NoError(t, c.Write("*1\r\n$4\r\nPING\r\n"))
r, err := c.ReadLine()
require.NoError(t, err)
require.Contains(t, r, "+PONG")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we write a new test case for the redis protocol validation about PING?

It seems that semantic verification and protocol verification have been put into one test case, which I think should be split into two cases.

Copy link
Contributor Author

@ColinChamber ColinChamber Oct 3, 2022

Choose a reason for hiding this comment

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

Yeah. Maybe it is not necessary to verify the protocol about PING. Some things are apparent. It makes the test too cumbersome.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Generally looks good. Comments inline.

tests/gocase/unit/introspection/introspection_test.go Outdated Show resolved Hide resolved
tests/gocase/unit/introspection/introspection_test.go Outdated Show resolved Hide resolved
tests/gocase/unit/introspection/introspection_test.go Outdated Show resolved Hide resolved
@tisonkun tisonkun self-requested a review October 3, 2022 14:11
@@ -5833,7 +5839,7 @@ class CommandXTrim : public Commander {

CommandAttributes redisCommandTable[] = {
ADD_CMD("auth", 2, "read-only ok-loading", 0, 0, 0, CommandAuth),
ADD_CMD("ping", 1, "read-only", 0, 0, 0, CommandPing),
ADD_CMD("ping", -1, "read-only", 0, 0, 0, CommandPing),
Copy link
Member

Choose a reason for hiding this comment

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

May I ask the reason to make this change? Is there some reference from the Redis document?

The overall change looks good to me. Merging...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This digit indicates the number of parameters allowed(including command name), "1 " means there is precisely one, and "-1 "means at least one. Do you want this source code and the comment?

Copy link
Member

Choose a reason for hiding this comment

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

Thank you!

@tisonkun tisonkun merged commit e674376 into apache:unstable Oct 4, 2022
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.

PING returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.
4 participants