diff options
author | Mark D. Roth <roth@google.com> | 2016-11-30 14:02:54 -0800 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2016-11-30 14:02:54 -0800 |
commit | 0699fa03ec313b139ec432f3ac9e93a277ae8a40 (patch) | |
tree | 8df2ca03b658361af7d22750643032165cb45932 /test/core/end2end/tests/filter_latency.c | |
parent | e62605f41e00c3e4652e0a7ad19846d8995a101f (diff) | |
parent | 71cf7b39dafdeb376370972551cbf78f2750d02e (diff) |
Merge remote-tracking branch 'upstream/master' into client_channel_init_cleanup
Diffstat (limited to 'test/core/end2end/tests/filter_latency.c')
-rw-r--r-- | test/core/end2end/tests/filter_latency.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.c index 9263dcc203..e10204863b 100644 --- a/test/core/end2end/tests/filter_latency.c +++ b/test/core/end2end/tests/filter_latency.c @@ -226,18 +226,6 @@ static void test_request(grpc_end2end_test_config config) { grpc_call_destroy(s); grpc_call_destroy(c); - const gpr_timespec end_time = gpr_now(GPR_CLOCK_MONOTONIC); - const gpr_timespec max_latency = gpr_time_sub(end_time, start_time); - - gpr_mu_lock(&g_mu); - GPR_ASSERT(gpr_time_cmp(max_latency, g_client_latency) >= 0); - GPR_ASSERT(gpr_time_cmp(gpr_time_0(GPR_TIMESPAN), g_client_latency) < 0); - GPR_ASSERT(gpr_time_cmp(max_latency, g_server_latency) >= 0); - GPR_ASSERT(gpr_time_cmp(gpr_time_0(GPR_TIMESPAN), g_server_latency) < 0); - // Server latency should always be smaller than client latency. - GPR_ASSERT(gpr_time_cmp(g_server_latency, g_client_latency) < 0); - gpr_mu_unlock(&g_mu); - cq_verifier_destroy(cqv); grpc_byte_buffer_destroy(request_payload); @@ -245,6 +233,24 @@ static void test_request(grpc_end2end_test_config config) { end_test(&f); config.tear_down_data(&f); + + const gpr_timespec end_time = gpr_now(GPR_CLOCK_MONOTONIC); + const gpr_timespec max_latency = gpr_time_sub(end_time, start_time); + + // Perform checks after test tear-down + // Guards against the case that there's outstanding channel-related work on a + // call prior to verification + gpr_mu_lock(&g_mu); + GPR_ASSERT(gpr_time_cmp(max_latency, g_client_latency) >= 0); + GPR_ASSERT(gpr_time_cmp(gpr_time_0(GPR_TIMESPAN), g_client_latency) <= 0); + GPR_ASSERT(gpr_time_cmp(max_latency, g_server_latency) >= 0); + GPR_ASSERT(gpr_time_cmp(gpr_time_0(GPR_TIMESPAN), g_server_latency) <= 0); + // Server latency should always be smaller than client latency, however since + // we only calculate latency at destruction time, and that might mean that we + // need to wait for outstanding channel-related work, this isn't verifiable + // right now (the server MAY hold on to the call for longer than the client). + // GPR_ASSERT(gpr_time_cmp(g_server_latency, g_client_latency) < 0); + gpr_mu_unlock(&g_mu); } /******************************************************************************* |