Skip to content

Potential bug in tests for testing headers and trailers #1499

@parthea

Description

@parthea

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

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions