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 flaky test TestParseHTTPRequest/Test_MSET_command #581

Closed
JyotinderSingh opened this issue Sep 14, 2024 · 3 comments
Closed

Fix flaky test TestParseHTTPRequest/Test_MSET_command #581

JyotinderSingh opened this issue Sep 14, 2024 · 3 comments
Assignees

Comments

@JyotinderSingh
Copy link
Collaborator

TestParseHTTPRequest/Test_MSET_command is flaky because the order of arguments in the converted response is non-deterministic.

Making the order deterministic in the adapter logic will entail a performance penalty for no real benefit (as of now). It's better we make the test more resilient by ensuring the test logic is able to handle all possible expected responses.

Screenshot 2024-09-14 at 6 17 48 PM

@phaneesh707
Copy link
Contributor

Hi @JyotinderSingh , i want to take up this issue, thanks!

@JyotinderSingh
Copy link
Collaborator Author

Hi @JyotinderSingh , i want to take up this issue, thanks!

Assigned.

@AayushVinayDev
Copy link

Hello @JyotinderSingh are these the test cases you're suggesting we should add ?

// Check if all expected arguments are present in the parsed command
			for key, value := range tc.expectedArgs {
				found := false
				for i := 0; i < len(redisCmd.Args); i += 2 {
					if i+1 < len(redisCmd.Args) && redisCmd.Args[i] == key && redisCmd.Args[i+1] == value {
						found = true
						break
					}
				}
				assert.True(t, found, "Expected argument %s with value %s not found in parsed command", key, value)
			}

			// Check if the number of arguments matches
			assert.Equal(t, len(tc.expectedArgs)*2, len(redisCmd.Args), "Number of arguments should match")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants