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

Potential bug in tests for testing headers and trailers #1499

Closed
parthea opened this issue Apr 13, 2024 · 0 comments · Fixed by #1500
Closed

Potential bug in tests for testing headers and trailers #1499

parthea opened this issue Apr 13, 2024 · 0 comments · Fixed by #1500
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@parthea
Copy link
Contributor

parthea commented Apr 13, 2024

The check below fails because of 2 issues. Incorrect expected values, and incorrect boolean comparison

if expectHeadersAndTrailers && !reflect.DeepEqual([]string{"show", "case"}, m.trail) && !reflect.DeepEqual([]string{"showcaseHeader, anotherHeader"}, m.head) {
m.t.Errorf("Unary stream did not get all expected headers and trailers.\nGot these headers: %+v\nGot these trailers: %+v", m.head, m.trail)
}

  1. In the code below, the expected values appear to be incorrect. We have "showcaseHeader, anotherHeader" instead of "showcaseHeader", "anotherHeader"
 !reflect.DeepEqual([]string{"showcaseHeader, anotherHeader"}
  1. We have && in the boolean check for verifying the value of both headers and trailers. It should be || so that if either check for headers or trailers fails, we get an error condition.

The way it is written now
NOT <condition> && NOT <condition> -> both conditions must be false for the error condition to appear

The way it should be
NOT <condition> || NOT <condition> -> only one condition should be false for the error condition to appear

@parthea parthea added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Apr 13, 2024
@parthea parthea self-assigned this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant