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) |
|
} |
- In the code below, the expected values appear to be incorrect. We have
"showcaseHeader, anotherHeader" instead of "showcaseHeader", "anotherHeader"
!reflect.DeepEqual([]string{"showcaseHeader, anotherHeader"}
- 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
The check below fails because of 2 issues. Incorrect expected values, and incorrect boolean comparison
gapic-showcase/server/services/echo_service_test.go
Lines 125 to 127 in 961e217
"showcaseHeader, anotherHeader"instead of"showcaseHeader", "anotherHeader"&&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 appearThe way it should be
NOT <condition> || NOT <condition>-> only one condition should be false for the error condition to appear