Fixed wrong spec and reworked streaming compressed case

pull/6839/head
David Garcia Quintas 9 years ago
parent 20d802db98
commit 485cf40ab7
  1. 36
      doc/interop-test-descriptions.md
  2. 17
      test/cpp/interop/interop_client.cc

@ -224,7 +224,7 @@ Procedure:
size: 31415
}
response_parameters:{
size: 59
size: 9
}
response_parameters:{
size: 2653
@ -261,20 +261,19 @@ Procedure:
request_compressed_response: bool
response_type:COMPRESSABLE
response_parameters:{
size: 31415
}
response_parameters:{
size: 59
}
response_parameters:{
size: 2653
size: 31424
}
response_parameters:{
size: 58979
size: 61632
}
}
```
Note that the `response_parameters` sizes are the sum of the usual streaming
response sizes (31415, 9, 2653, 58979) taken in successive pairs. This way,
we only keep a single list of sizes while making sure the individual message
sizes are large enough to trigger compression in all implementations.
Client asserts:
* call was successful
* exactly four responses
@ -283,7 +282,7 @@ Procedure:
NOT have the compressed message flag set.
* if `request_compressed_response` is true, the response's messages MUST
have the compressed message flag set.
* response payload bodies are sized (in order): 31415, 59, 2653, 58979
* response payload bodies are sized (in order): 31424, 61632
* clients are free to assert that the response payload body contents are
zero and comparing the entire response messages against golden responses
@ -295,16 +294,10 @@ Procedure:
request_compressed_response: bool
response_type:UNCOMPRESSABLE
response_parameters:{
size: 31415
}
response_parameters:{
size: 59
}
response_parameters:{
size: 2653
size: 31424
}
response_parameters:{
size: 58979
size: 61632
}
}
```
@ -316,10 +309,7 @@ Procedure:
* the response MAY have the compressed message flag set. Some
implementations will choose to compress the payload even when the output
size if larger than the input.
* response payload bodies are sized (in order): 31415, 59, 2653, 58979
* clients are free to assert that the body of the responses are identical to
the golden uncompressable data at `test/cpp/interop/rnd.dat`.
* response payload bodies are sized (in order): 31424, 61632
### ping_pong
@ -350,7 +340,7 @@ Procedure:
{
response_type: COMPRESSABLE
response_parameters:{
size: 59
size: 9
}
payload:{
body: 8 bytes of zeros

@ -58,7 +58,7 @@ namespace testing {
namespace {
// The same value is defined by the Java client.
const std::vector<int> request_stream_sizes = {27182, 8, 1828, 45904};
const std::vector<int> response_stream_sizes = {31415, 59, 2653, 58979};
const std::vector<int> response_stream_sizes = {31415, 9, 2653, 58979};
const int kNumResponseMessages = 2000;
const int kResponseMessageSize = 1030;
const int kReceiveDelayMilliSeconds = 20;
@ -466,10 +466,11 @@ bool InteropClient::DoResponseCompressedStreaming() {
request.set_response_type(payload_types[i]);
request.set_request_compressed_response(request_compression[j]);
for (size_t k = 0; k < response_stream_sizes.size(); ++k) {
for (size_t k = 0; k < response_stream_sizes.size() / 2; ++k) {
ResponseParameters* response_parameter =
request.add_response_parameters();
response_parameter->set_size(response_stream_sizes[k]);
response_parameter->set_size(response_stream_sizes[k] +
response_stream_sizes[k + 1]);
}
StreamingOutputCallResponse response;
@ -483,7 +484,9 @@ bool InteropClient::DoResponseCompressedStreaming() {
switch (response.payload().type()) {
case PayloadType::COMPRESSABLE:
GPR_ASSERT(response.payload().body() ==
grpc::string(response_stream_sizes[k], '\0'));
grpc::string(response_stream_sizes[k] +
response_stream_sizes[k + 1],
'\0'));
break;
case PayloadType::UNCOMPRESSABLE:
break;
@ -513,14 +516,14 @@ bool InteropClient::DoResponseCompressedStreaming() {
gpr_log(GPR_DEBUG, "Response streaming done %s.", log_suffix);
gpr_free(log_suffix);
if (k < response_stream_sizes.size()) {
if (k < response_stream_sizes.size() / 2) {
// stream->Read() failed before reading all the expected messages. This
// is most likely due to a connection failure.
gpr_log(GPR_ERROR,
"DoResponseCompressedStreaming(): Responses read (k=%d) is "
"less than the expected messages (i.e "
"response_stream_sizes.size() (%d)). (i=%d, j=%d)",
k, response_stream_sizes.size(), i, j);
"response_stream_sizes.size()/2 (%d)). (i=%d, j=%d)",
k, response_stream_sizes.size() / 2, i, j);
return TransientFailureOrAbort();
}

Loading…
Cancel
Save