adapt test cases
Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
parent
722be68976
commit
c7bfc60d53
|
|
@ -260,6 +260,20 @@ const (
|
||||||
"payload": {
|
"payload": {
|
||||||
"body": "SXQncyBCdXNpbmVzcyBUaW1l"
|
"body": "SXQncyBCdXNpbmVzcyBUaW1l"
|
||||||
}
|
}
|
||||||
|
}`
|
||||||
|
fullResponse1 = `{
|
||||||
|
"payload": {
|
||||||
|
"type": "COMPRESSABLE",
|
||||||
|
"body": "SXQncyBCdXNpbmVzcyBUaW1l"
|
||||||
|
},
|
||||||
|
"username": "",
|
||||||
|
"oauthScope": ""
|
||||||
|
}`
|
||||||
|
response1 = `{
|
||||||
|
"payload": {
|
||||||
|
"type": "COMPRESSABLE",
|
||||||
|
"body": "SXQncyBCdXNpbmVzcyBUaW1l"
|
||||||
|
}
|
||||||
}`
|
}`
|
||||||
payload2 = `{
|
payload2 = `{
|
||||||
"payload": {
|
"payload": {
|
||||||
|
|
@ -292,7 +306,7 @@ func doTestUnary(t *testing.T, cc *grpc.ClientConn, source DescriptorSource) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.check(t, "grpc.testing.TestService.UnaryCall", codes.OK, 1, 1) {
|
if h.check(t, "grpc.testing.TestService.UnaryCall", codes.OK, 1, 1) {
|
||||||
if h.respMessages[0] != payload1 {
|
if h.respMessages[0] != fullResponse1 {
|
||||||
t.Errorf("unexpected response from RPC: expecting %s; got %s", payload1, h.respMessages[0])
|
t.Errorf("unexpected response from RPC: expecting %s; got %s", payload1, h.respMessages[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -424,6 +438,7 @@ func TestHalfDuplexStreamReflect(t *testing.T) {
|
||||||
|
|
||||||
func doTestHalfDuplexStream(t *testing.T, cc *grpc.ClientConn, source DescriptorSource) {
|
func doTestHalfDuplexStream(t *testing.T, cc *grpc.ClientConn, source DescriptorSource) {
|
||||||
reqs := []string{payload1, payload2, payload3}
|
reqs := []string{payload1, payload2, payload3}
|
||||||
|
resps := []string{response1, payload2, payload3}
|
||||||
|
|
||||||
// Success
|
// Success
|
||||||
h := &handler{reqMessages: reqs}
|
h := &handler{reqMessages: reqs}
|
||||||
|
|
@ -434,8 +449,8 @@ func doTestHalfDuplexStream(t *testing.T, cc *grpc.ClientConn, source Descriptor
|
||||||
|
|
||||||
if h.check(t, "grpc.testing.TestService.HalfDuplexCall", codes.OK, 3, 3) {
|
if h.check(t, "grpc.testing.TestService.HalfDuplexCall", codes.OK, 3, 3) {
|
||||||
for i, resp := range h.respMessages {
|
for i, resp := range h.respMessages {
|
||||||
if resp != reqs[i] {
|
if resp != resps[i] {
|
||||||
t.Errorf("unexpected response %d from RPC:\nexpecting %q\ngot %q", i, reqs[i], resp)
|
t.Errorf("unexpected response %d from RPC:\nexpecting %q\ngot %q", i, resps[i], resp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue