aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/tests
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-11-28 09:24:01 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-11-28 09:24:01 -0800
commit25dba29540b2421affea885664bf801f1e930066 (patch)
treea1b087084f2fd404552a1318b2f7a484b9c47c90 /test/core/end2end/tests
parentf2876ea1e0bbb3639007856cf7ea528a19d2d965 (diff)
Move test block, refine conditions
Diffstat (limited to 'test/core/end2end/tests')
-rw-r--r--test/core/end2end/tests/filter_latency.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.c
index 37ce3b1222..e43d584f73 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,23 @@ 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 an outstanding write, this isn't verifiable right now.
+ // GPR_ASSERT(gpr_time_cmp(g_server_latency, g_client_latency) < 0);
+ gpr_mu_unlock(&g_mu);
}
/*******************************************************************************