aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/tests/filter_latency.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-11-30 13:41:53 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-11-30 13:41:53 -0800
commit36b3135929cf1561d35039fc9e04e038f5351ed7 (patch)
treeb20b4f6ab4043fae9a170adb711b488be0bd1a59 /test/core/end2end/tests/filter_latency.c
parent0f97958b64a792e551aa3bde84bb8f53b04de3b4 (diff)
parent369ddc524a6ca55afb8e8bd6743ed5624e1a94ce (diff)
Merge branch 'slice_interning' into metadata_filter
Diffstat (limited to 'test/core/end2end/tests/filter_latency.c')
-rw-r--r--test/core/end2end/tests/filter_latency.c30
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 e5288d5ef7..91e9fd9fc5 100644
--- a/test/core/end2end/tests/filter_latency.c
+++ b/test/core/end2end/tests/filter_latency.c
@@ -227,18 +227,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);
@@ -246,6 +234,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);
}
/*******************************************************************************