Skip to content

[TestSuit] Fix CanDoSRANDMEMBERWithCountCommandLC test #1143

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

prvyk
Copy link
Contributor

@prvyk prvyk commented Mar 29, 2025

The test didn't really test for duplicate members, because it didn't update arrLenEndIdx, so the next loop run just compared against the previous - passing regardless of actual behaviour (which happened to be per spec, but the test should still work).

Also fix remaining Encoding.ASCII.GetString usages.

@TalZaccai TalZaccai self-requested a review April 1, 2025 18:18
@prvyk prvyk force-pushed the CanDoSRANDMEMBERTest branch from 98ad5a4 to 2a3e5d7 Compare April 5, 2025 11:37
@badrishc badrishc requested a review from TedHartMS April 8, 2025 18:17
@prvyk prvyk force-pushed the CanDoSRANDMEMBERTest branch from 2a3e5d7 to c7bd663 Compare April 10, 2025 23:21
@prvyk prvyk requested a review from TalZaccai April 11, 2025 19:19
@prvyk prvyk force-pushed the CanDoSRANDMEMBERTest branch from c7bd663 to 3f57609 Compare April 15, 2025 01:00
@prvyk prvyk force-pushed the CanDoSRANDMEMBERTest branch 3 times, most recently from 5eec15f to 0eab7d4 Compare April 24, 2025 13:45
@prvyk prvyk force-pushed the CanDoSRANDMEMBERTest branch from 0eab7d4 to 790d92c Compare May 7, 2025 09:41

string[] results;

fixed (byte* p = &response[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

These changes might be a bit hard to read and also make the innerworkings of LightClient not well hidden.
We're also not validating that the members returned are in the set.
Since we don't have to worry about perf here, I'd say we should just read the members one by one and validate their set membership.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would rather avoid yet another copy of RESP parsing code.

Rewrote the test to use GarnetClientSession and it can parse the array for us. Also, added testing that all members returned are in the set.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well the original test was testing the command with LightClient, so using GarnetClient (while valuable) is inconsistent with other tests in this context. I understand your concern about duplicated parsing logic, but it's how it's been done throughout the test code, so I think that for consistency's sake we should stick to it until we decide to do some wide overhaul of the LC-related code.

@badrishc
Copy link
Collaborator

badrishc commented Jun 3, 2025

Where are we on the pending requests for this PR? It's been open quite a while, would be good to close on it, thanks!

@prvyk
Copy link
Contributor Author

prvyk commented Jun 3, 2025

I need to return the test to lightClient (reverting the last commit or so) and then copy some RespReadUtils code to Garnet.test and adjust to read out of a normal string (we don't care about being ultra fast there). It's not a problem, I was just prioritizing other PRs...

@TalZaccai
Copy link
Contributor

I need to return the test to lightClient (reverting the last commit or so) and then copy some RespReadUtils code to Garnet.test and adjust to read out of a normal string (we don't care about being ultra fast there). It's not a problem, I was just prioritizing other PRs...

Please re-request a review when this is ready so I can take a look :) Thanks!

@prvyk prvyk force-pushed the CanDoSRANDMEMBERTest branch from e23416d to bfe30bc Compare June 4, 2025 14:21
@prvyk prvyk force-pushed the CanDoSRANDMEMBERTest branch from bfe30bc to fabe79d Compare June 4, 2025 14:29
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.

3 participants