aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-03-27 15:59:50 -0700
committerGravatar GitHub <noreply@github.com>2018-03-27 15:59:50 -0700
commitc2a89cbdab0a3988f1935032681278a6d213edce (patch)
tree672a1d1f1953d0ac8724dbd690fcf5b75c56cbca /test
parentcb004080fa3da91c1e35c3012171058983871770 (diff)
parente7ef1e5968cf81f622843f2712a9eeec434d1189 (diff)
Merge pull request #14769 from yashykt/sslcerttestfix
Use same queue for batch ops and for shutdown in h2_ssl_cert_test
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/h2_ssl_cert_test.cc30
1 files changed, 5 insertions, 25 deletions
diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc
index 9e2082ce9d..0741e7c39b 100644
--- a/test/core/end2end/h2_ssl_cert_test.cc
+++ b/test/core/end2end/h2_ssl_cert_test.cc
@@ -57,8 +57,6 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(nullptr);
- f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
-
return f;
}
@@ -270,27 +268,13 @@ static void drain_cq(grpc_completion_queue* cq) {
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
+// Shuts down the server.
+// Side effect - Also shuts down and drains the completion queue.
static void shutdown_server(grpc_end2end_test_fixture* f) {
if (!f->server) return;
- /* Perform a completion queue next, so that any pending operations can be
- * finished, and resources can be released. This is so that, shutdown does not
- * hang. For example, the server might be stuck in the handshaking code, which
- * keeps a ref to a listener. Unless, it is unref'd, shutdown won't be able
- * to proceed.
- *
- * (If shutdown times out, it is probably because 100ms wasn't enough. In that
- * case, the deadline can be increased. Or, we could simply have another
- * thread for the server to poll the completion queue while the shutdown
- * progresses.)
- */
- GPR_ASSERT(grpc_completion_queue_next(
- f->cq, grpc_timeout_milliseconds_to_deadline(100), nullptr)
- .type == GRPC_QUEUE_TIMEOUT);
- grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
- GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
- grpc_timeout_seconds_to_deadline(5),
- nullptr)
- .type == GRPC_OP_COMPLETE);
+ grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
+ grpc_completion_queue_shutdown(f->cq);
+ drain_cq(f->cq);
grpc_server_destroy(f->server);
f->server = nullptr;
}
@@ -304,11 +288,7 @@ static void shutdown_client(grpc_end2end_test_fixture* f) {
static void end_test(grpc_end2end_test_fixture* f) {
shutdown_client(f);
shutdown_server(f);
-
- grpc_completion_queue_shutdown(f->cq);
- drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
- grpc_completion_queue_destroy(f->shutdown_cq);
}
static void simple_request_body(grpc_end2end_test_fixture f,