diff --git a/test/boost/encryption_at_rest_test.cc b/test/boost/encryption_at_rest_test.cc index 3ac78660aa..4e57d4a842 100644 --- a/test/boost/encryption_at_rest_test.cc +++ b/test/boost/encryption_at_rest_test.cc @@ -305,6 +305,9 @@ static future<> kmip_test_helper(const std::function(const kmip_test_in std::future pykmip_status; + std::promise port_promise; + auto fut = port_promise.get_future(); + static const char* def_resourcedir = "./test/resource/certs"; const char* resourcedir = std::getenv("KMIP_RESOURCE_DIR"); if (resourcedir == nullptr) { @@ -368,9 +371,6 @@ database_path=:memory: bp::env["TMPDIR"]=tmp.path().string() ); - std::promise port_promise; - auto f = port_promise.get_future(); - pykmip_status = std::async([&] { static std::regex port_ex("Listening on (\\d+)"); @@ -393,10 +393,10 @@ database_path=:memory: } }); // arbitrary timeout of 20s for the server to make some output. Very generous. - if (f.wait_for(20s) == std::future_status::timeout) { + if (fut.wait_for(20s) == std::future_status::timeout) { throw std::runtime_error("Could not start pykmip"); } - auto port = f.get(); + auto port = fut.get(); if (port <= 0) { throw std::runtime_error("Invalid port"); }