aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar David Klempner <klempner@google.com>2016-05-13 15:24:17 -0700
committerGravatar David Klempner <klempner@google.com>2016-05-13 15:24:17 -0700
commit6fb122dc6e6245963534432c93418aadecd2e72f (patch)
tree3fbcc98a9042444b12420ab6b416cacb2bd6eaf4 /test/cpp
parentc7614cf2779c4909d8ec3f64923242cfd02f157a (diff)
Add calls to grpc_recycle_unused_port to two of the tests which call
grpc_pick_unused_port a lot.
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/end2end/async_end2end_test.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index e0649bd694..45f5eb1ddd 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -245,8 +245,8 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
void SetUp() GRPC_OVERRIDE {
poll_overrider_.reset(new PollingOverrider(!GetParam().disable_blocking));
- int port = grpc_pick_unused_port_or_die();
- server_address_ << "localhost:" << port;
+ port_ = grpc_pick_unused_port_or_die();
+ server_address_ << "localhost:" << port_;
// Setup server
ServerBuilder builder;
@@ -274,6 +274,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
;
poll_overrider_.reset();
gpr_tls_set(&g_is_async_end2end_test, 0);
+ grpc_recycle_unused_port(port_);
}
void ResetStub() {
@@ -325,6 +326,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
std::unique_ptr<Server> server_;
grpc::testing::EchoTestService::AsyncService service_;
std::ostringstream server_address_;
+ int port_;
std::unique_ptr<PollingOverrider> poll_overrider_;
};