aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Makarand Dharmapurikar <makarandd@google.com>2017-04-14 09:07:02 -0700
committerGravatar Makarand Dharmapurikar <makarandd@google.com>2017-04-14 09:07:02 -0700
commitd65b44a3dbb631ce313b17402725f976e47a55e3 (patch)
tree10f29fe3e0c21aa97d0263983eec4af20162f74e /test
parent957562780adb3f92afbaf19bf7a68f397c55b6d3 (diff)
parent63ed60f0483523522067d098abb6044ab6b99e27 (diff)
Merge branch 'caching_uri' of https://github.com/makdharma/grpc into makdharma-caching_uri
Diffstat (limited to 'test')
-rw-r--r--test/cpp/interop/client.cc4
-rw-r--r--test/cpp/interop/interop_client.cc20
2 files changed, 22 insertions, 2 deletions
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index 369413e6a1..6f1d910304 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -163,8 +163,8 @@ int main(int argc, char** argv) {
std::bind(&grpc::testing::InteropClient::DoUnimplementedMethod, &client);
actions["unimplemented_service"] =
std::bind(&grpc::testing::InteropClient::DoUnimplementedService, &client);
- // actions["cacheable_unary"] =
- // std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client);
+ actions["cacheable_unary"] =
+ std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client);
UpdateActions(&actions);
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index 55ba324cc7..0e79c5e4b4 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -918,6 +918,26 @@ bool InteropClient::DoCacheableUnary() {
// second response is a cached copy of the first response
GPR_ASSERT(response2.payload().body() == response1.payload().body());
+ // Request 3
+ // Modify the request body so it will not get a cache hit
+ ts = gpr_now(GPR_CLOCK_PRECISE);
+ timestamp = std::to_string((long long unsigned)ts.tv_nsec);
+ SimpleRequest request1;
+ request1.mutable_payload()->set_body(timestamp.c_str(), timestamp.size());
+ ClientContext context3;
+ SimpleResponse response3;
+ context3.set_cacheable(true);
+ context3.AddMetadata("x-user-ip", "1.2.3.4");
+ Status s3 =
+ serviceStub_.Get()->CacheableUnaryCall(&context3, request1, &response3);
+ if (!AssertStatusOk(s3)) {
+ return false;
+ }
+ gpr_log(GPR_DEBUG, "response 3 payload: %s",
+ response3.payload().body().c_str());
+
+ // Check that the response is different from the previous response.
+ GPR_ASSERT(response3.payload().body() != response1.payload().body());
return true;
}