From 59dcb2b2920081e139e1eadacd8a084b4df3c56b Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 12 Aug 2021 15:27:16 +0000 Subject: [PATCH 1/6] fix: actually handle sessions in parallel We were creating a thread to handle each request, and then promptly blocking until the thread completed. With this change we leave the thread running. Before accepting a new connection we cleanup the memory resources for old sessions, not that they are that big. We block and stop accepting requests if there are 64 sessions running, at that point it is probably better to let the hosting environment (Cloud Run, Cloud Functions, whatever) create new instances to handle the additional load. --- .../basic_integration_test.cc | 33 +++++++++++++++++ .../integration_tests/echo_server.cc | 36 ++++++++++++++----- .../functions/internal/framework_impl.cc | 31 ++++++++++++++-- 3 files changed, 88 insertions(+), 12 deletions(-) diff --git a/google/cloud/functions/integration_tests/basic_integration_test.cc b/google/cloud/functions/integration_tests/basic_integration_test.cc index 2b3253d6..37628e3d 100644 --- a/google/cloud/functions/integration_tests/basic_integration_test.cc +++ b/google/cloud/functions/integration_tests/basic_integration_test.cc @@ -20,7 +20,9 @@ #include #include #include +#include #include +#include #include namespace google::cloud::functions_internal { @@ -28,6 +30,8 @@ inline namespace FUNCTIONS_FRAMEWORK_CPP_NS { namespace { using ::testing::HasSubstr; +using ::testing::Each; + namespace bp = boost::process; // Even with C++17, we have to use the Boost version because Boost.Process // expects it. @@ -198,6 +202,35 @@ TEST(RunIntegrationTest, ConformanceSmokeTest) { EXPECT_EQ(server.exit_code(), 0); } +TEST(RunIntegrationTest, SomeParallelism) { + auto server = bp::child(ExePath(kServer), "--port=8010"); + auto result = WaitForServerReady("localhost", "8010"); + ASSERT_EQ(result, 0); + + auto const kTaskCount = 16; + auto task = [] { + auto start = std::chrono::steady_clock::now(); + (void)HttpGet("localhost", "8010", "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/sleep/1000"); + return std::chrono::duration_cast( + std::chrono::steady_clock::now() - start); + }; + std::vector> tasks(kTaskCount); + std::generate(tasks.begin(), tasks.end(), + [&] { return std::async(std::launch::async, task); }); + std::vector elapsed(tasks.size()); + std::transform(tasks.begin(), tasks.end(), elapsed.begin(), + [](auto& f) { return f.get(); }); + // We ask for a 1s delay, but we tolerate up to 5. + EXPECT_THAT(elapsed, Each(::testing::Le(std::chrono::seconds(5)))); + + try { + (void)HttpGet("localhost", "8010", "/quit/program/0"); + } catch (...) { + } + server.wait(); + EXPECT_EQ(server.exit_code(), 0); +} + } // namespace } // namespace FUNCTIONS_FRAMEWORK_CPP_NS } // namespace google::cloud::functions_internal diff --git a/google/cloud/functions/integration_tests/echo_server.cc b/google/cloud/functions/integration_tests/echo_server.cc index f48fd727..f99da180 100644 --- a/google/cloud/functions/integration_tests/echo_server.cc +++ b/google/cloud/functions/integration_tests/echo_server.cc @@ -13,10 +13,13 @@ // limitations under the License. #include "google/cloud/functions/framework.h" +#include +#include #include #include #include #include +#include namespace functions = ::google::cloud::functions; using functions::HttpRequest; @@ -47,19 +50,34 @@ HttpResponse EchoServer(HttpRequest const& request) { std::clog << "stderr: " << target << "\n"; } - std::ostringstream payload; - payload << "{\n" - << R"js( "target": ")js" << target << "\"\n" - << R"js( "verb": ")js" << request.verb() << "\"\n" - << R"js( "headers": [)js"; - for (auto [k, v] : request.headers()) { - payload << '"' << k << ": " << v << '"' << "\n"; + auto const sleep_prefix = std::string{"/sleep/"}; + if (target.rfind(sleep_prefix, 0) == 0) { + auto const delay = std::stoi(target.substr(sleep_prefix.size())); + std::this_thread::sleep_for(std::chrono::milliseconds(delay)); } - payload << "}\n"; + + auto tid = [] { + std::ostringstream os; + os << std::this_thread::get_id(); + return std::move(os).str(); + }; + auto headers = [&] { + std::vector h(request.headers().size()); + std::transform(request.headers().begin(), request.headers().end(), + h.begin(), + [](auto const& kv) { return kv.first + ": " + kv.second; }); + return h; + }; + auto payload = nlohmann::json{ + {"thread", tid()}, + {"target", target}, + {"verb", request.verb()}, + {"headers", headers()}, + }; return HttpResponse{} .set_header("Content-Type", "application/json") - .set_payload(std::move(payload).str()); + .set_payload(payload.dump(2)); } int main(int argc, char* argv[]) { diff --git a/google/cloud/functions/internal/framework_impl.cc b/google/cloud/functions/internal/framework_impl.cc index 2855d5a9..8c98df31 100644 --- a/google/cloud/functions/internal/framework_impl.cc +++ b/google/cloud/functions/internal/framework_impl.cc @@ -75,9 +75,9 @@ int RunForTestImpl(int argc, char const* const argv[], UserFunction&& function, auto address = asio::ip::make_address(vm["address"].as()); auto port = vm["port"].as(); - // TODO(#35) - maybe replace with Boost.Log - asio::io_context ioc{/*concurrency_hint=*/1}; + asio::io_context ioc{1}; tcp::acceptor acceptor{ioc, {address, static_cast(port)}}; + acceptor.listen(boost::asio::socket_base::max_connections); actual_port(acceptor.local_endpoint().port()); auto handle_session = @@ -85,11 +85,36 @@ int RunForTestImpl(int argc, char const* const argv[], UserFunction&& function, HandleSession(std::move(socket), h); }; + auto cleanup = [](std::vector> sessions, auto wait) { + std::vector> running; + for (auto& s : sessions) { + if (s.wait_for(wait) == std::future_status::timeout) { + running.push_back(std::move(s)); + continue; + } + s.get(); + } + return running; + }; + + // Reaching this number of sessions triggers a cleanup of any sessions that + // may have finished already. + auto constexpr kSessionCleanupThreshold = 32; + // If we reach this number of sessions we block until we are below the count. + auto constexpr kMaximumSessions = 64; + std::vector> sessions; while (!shutdown()) { + if (sessions.size() >= kSessionCleanupThreshold) { + sessions = cleanup(std::move(sessions), std::chrono::milliseconds(0)); + } + while (sessions.size() >= kMaximumSessions) { + sessions = cleanup(std::move(sessions), std::chrono::seconds(1)); + } auto socket = acceptor.accept(ioc); if (!socket.is_open()) break; // Run a thread per-session, transferring ownership of the socket - (void)std::async(std::launch::async, handle_session, std::move(socket)); + sessions.push_back( + std::async(std::launch::async, handle_session, std::move(socket))); } return 0; } From b430c11d82463f47ea0f0d010a601a6e702c7af3 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 12 Aug 2021 15:34:50 +0000 Subject: [PATCH 2/6] Fix formatting --- .../cloud/functions/integration_tests/basic_integration_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/functions/integration_tests/basic_integration_test.cc b/google/cloud/functions/integration_tests/basic_integration_test.cc index 37628e3d..50423b2a 100644 --- a/google/cloud/functions/integration_tests/basic_integration_test.cc +++ b/google/cloud/functions/integration_tests/basic_integration_test.cc @@ -29,8 +29,8 @@ namespace google::cloud::functions_internal { inline namespace FUNCTIONS_FRAMEWORK_CPP_NS { namespace { -using ::testing::HasSubstr; using ::testing::Each; +using ::testing::HasSubstr; namespace bp = boost::process; // Even with C++17, we have to use the Boost version because Boost.Process From 8a604234a56daddba1e031bd0621324269df41d8 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 12 Aug 2021 17:16:20 +0000 Subject: [PATCH 3/6] Better values for concurrency --- google/cloud/functions/internal/framework_impl.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/google/cloud/functions/internal/framework_impl.cc b/google/cloud/functions/internal/framework_impl.cc index 8c98df31..c7ceaeaf 100644 --- a/google/cloud/functions/internal/framework_impl.cc +++ b/google/cloud/functions/internal/framework_impl.cc @@ -98,10 +98,15 @@ int RunForTestImpl(int argc, char const* const argv[], UserFunction&& function, }; // Reaching this number of sessions triggers a cleanup of any sessions that - // may have finished already. - auto constexpr kSessionCleanupThreshold = 32; - // If we reach this number of sessions we block until we are below the count. - auto constexpr kMaximumSessions = 64; + // may have finished already. We allow up to 80 sessions to start without + // blocking, this should be enough for Cloud Run and Cloud Functions: + // https://cloud.google.com/run/docs/about-concurrency#concurrency_values + auto constexpr kSessionCleanupThreshold = 80; + + // If we reach this number of sessions we block until we are below the cleanup + // threshold. + auto constexpr kMaximumSessions = 160; + std::vector> sessions; while (!shutdown()) { if (sessions.size() >= kSessionCleanupThreshold) { From 9fdfe804a0cbb8c3514bdb99f669a9e858336576 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 12 Aug 2021 19:50:21 +0000 Subject: [PATCH 4/6] Fix clang-tidy --- .../cloud/functions/integration_tests/basic_integration_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/functions/integration_tests/basic_integration_test.cc b/google/cloud/functions/integration_tests/basic_integration_test.cc index 50423b2a..72701499 100644 --- a/google/cloud/functions/integration_tests/basic_integration_test.cc +++ b/google/cloud/functions/integration_tests/basic_integration_test.cc @@ -207,7 +207,7 @@ TEST(RunIntegrationTest, SomeParallelism) { auto result = WaitForServerReady("localhost", "8010"); ASSERT_EQ(result, 0); - auto const kTaskCount = 16; + auto constexpr kTaskCount = 16; auto task = [] { auto start = std::chrono::steady_clock::now(); (void)HttpGet("localhost", "8010", "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/sleep/1000"); From 97b30d402fae66841ab7d849baceb4cb0906b1b8 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 12 Aug 2021 21:28:02 +0000 Subject: [PATCH 5/6] Cannot use std::exit(0) with ThreadSanitizer --- .../basic_integration_test.cc | 5 ++ .../cloud_event_conformance.cc | 15 ++++-- .../integration_tests/cloud_event_handler.cc | 17 ++++-- .../cloud_event_integration_test.cc | 6 +++ .../integration_tests/echo_server.cc | 54 ++++++++----------- .../integration_tests/http_conformance.cc | 13 +++-- 6 files changed, 67 insertions(+), 43 deletions(-) diff --git a/google/cloud/functions/integration_tests/basic_integration_test.cc b/google/cloud/functions/integration_tests/basic_integration_test.cc index 72701499..2cfbcd30 100644 --- a/google/cloud/functions/integration_tests/basic_integration_test.cc +++ b/google/cloud/functions/integration_tests/basic_integration_test.cc @@ -124,6 +124,7 @@ TEST(RunIntegrationTest, Basic) { try { (void)HttpGet("localhost", "8010", "/quit/program/0"); + (void)HttpGet("localhost", "8010", "/quit/program/0"); } catch (...) { } server.wait(); @@ -152,6 +153,7 @@ TEST(RunIntegrationTest, ExceptionLogsToStderr) { try { (void)HttpGet("localhost", "8010", "/quit/program/0"); + (void)HttpGet("localhost", "8010", "/quit/program/0"); } catch (...) { } server.wait(); @@ -183,6 +185,7 @@ TEST(RunIntegrationTest, OutputIsFlushed) { try { (void)HttpGet("localhost", "8010", "/quit/program/0"); + (void)HttpGet("localhost", "8010", "/quit/program/0"); } catch (...) { } server.wait(); @@ -196,6 +199,7 @@ TEST(RunIntegrationTest, ConformanceSmokeTest) { try { (void)HttpGet("localhost", "8010", "/quit/program/0"); + (void)HttpGet("localhost", "8010", "/quit/program/0"); } catch (...) { } server.wait(); @@ -225,6 +229,7 @@ TEST(RunIntegrationTest, SomeParallelism) { try { (void)HttpGet("localhost", "8010", "/quit/program/0"); + (void)HttpGet("localhost", "8010", "/quit/program/0"); } catch (...) { } server.wait(); diff --git a/google/cloud/functions/integration_tests/cloud_event_conformance.cc b/google/cloud/functions/integration_tests/cloud_event_conformance.cc index 44adab92..44efaf54 100644 --- a/google/cloud/functions/integration_tests/cloud_event_conformance.cc +++ b/google/cloud/functions/integration_tests/cloud_event_conformance.cc @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "google/cloud/functions/framework.h" -#include +#include "google/cloud/functions/internal/framework_impl.h" +#include // NOLINT(modernize-deprecated-headers) #include +#include #include namespace functions = ::google::cloud::functions; + +std::atomic shutdown_server{false}; + void CloudEventConformance(functions::CloudEvent const& ev) { // This output name is hard requirement from the conformance testing // framework. @@ -54,9 +58,12 @@ void CloudEventConformance(functions::CloudEvent const& ev) { std::ofstream(kOutputFilename) << event.dump() << "\n"; // This is here just to gracefully shutdown and collect coverage data. - if (ev.subject() == "/quit/program/0") std::exit(0); + if (ev.subject() == "/quit/program/0") shutdown_server.store(true); } int main(int argc, char* argv[]) { - return functions::Run(argc, argv, CloudEventConformance); + return google::cloud::functions_internal::RunForTest( + argc, argv, CloudEventConformance, + std::function{[] { return shutdown_server.load(); }}, + std::function([](int) {})); } diff --git a/google/cloud/functions/integration_tests/cloud_event_handler.cc b/google/cloud/functions/integration_tests/cloud_event_handler.cc index e67948d6..9e7d5ca5 100644 --- a/google/cloud/functions/integration_tests/cloud_event_handler.cc +++ b/google/cloud/functions/integration_tests/cloud_event_handler.cc @@ -12,16 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "google/cloud/functions/framework.h" -#include +#include "google/cloud/functions/internal/framework_impl.h" +#include #include -namespace functions = google::cloud::functions; using ::google::cloud::functions::CloudEvent; +std::atomic shutdown_server{false}; + void CloudEventHandler(CloudEvent const& event) { auto const& subject = event.subject().value_or(""); - if (subject == "/quit/program/0") std::exit(0); + if (subject == "/quit/program/0") { + shutdown_server.store(true); + return; + } if (subject.rfind("/exception/", 0) == 0) throw std::runtime_error(subject); if (subject.rfind("/unknown-exception/", 0) == 0) throw "uh-oh"; if (subject.rfind("/buffered-stdout/", 0) == 0) { @@ -33,5 +37,8 @@ void CloudEventHandler(CloudEvent const& event) { } int main(int argc, char* argv[]) { - return functions::Run(argc, argv, CloudEventHandler); + return google::cloud::functions_internal::RunForTest( + argc, argv, CloudEventHandler, + std::function{[] { return shutdown_server.load(); }}, + std::function([](int) {})); } diff --git a/google/cloud/functions/integration_tests/cloud_event_integration_test.cc b/google/cloud/functions/integration_tests/cloud_event_integration_test.cc index a0e6041f..5d7abdc3 100644 --- a/google/cloud/functions/integration_tests/cloud_event_integration_test.cc +++ b/google/cloud/functions/integration_tests/cloud_event_integration_test.cc @@ -200,6 +200,7 @@ TEST(RunIntegrationTest, Basic) { try { (void)HttpPost("localhost", "8020", "/quit/program/0"); + (void)HttpPost("localhost", "8020", "/quit/program/0"); } catch (...) { } server.wait(); @@ -215,6 +216,7 @@ TEST(RunIntegrationTest, Batch) { EXPECT_EQ(actual.result_int(), functions::HttpResponse::kOkay); try { (void)HttpPost("localhost", "8020", "/quit/program/0"); + (void)HttpPost("localhost", "8020", "/quit/program/0"); } catch (...) { } server.wait(); @@ -230,6 +232,7 @@ TEST(RunIntegrationTest, Binary) { EXPECT_EQ(actual.result_int(), functions::HttpResponse::kOkay); try { (void)HttpPost("localhost", "8020", "/quit/program/0"); + (void)HttpPost("localhost", "8020", "/quit/program/0"); } catch (...) { } server.wait(); @@ -258,6 +261,7 @@ TEST(RunIntegrationTest, ExceptionLogsToStderr) { try { (void)HttpPost("localhost", "8020", "/quit/program/0"); + (void)HttpPost("localhost", "8020", "/quit/program/0"); } catch (...) { } server.wait(); @@ -289,6 +293,7 @@ TEST(RunIntegrationTest, OutputIsFlushed) { try { (void)HttpPost("localhost", "8020", "/quit/program/0"); + (void)HttpPost("localhost", "8020", "/quit/program/0"); } catch (...) { } server.wait(); @@ -302,6 +307,7 @@ TEST(RunIntegrationTest, ConformanceSmokeTest) { try { (void)HttpPost("localhost", "8020", "/quit/program/0"); + (void)HttpPost("localhost", "8020", "/quit/program/0"); } catch (...) { } server.wait(); diff --git a/google/cloud/functions/integration_tests/echo_server.cc b/google/cloud/functions/integration_tests/echo_server.cc index f99da180..ecf491ad 100644 --- a/google/cloud/functions/integration_tests/echo_server.cc +++ b/google/cloud/functions/integration_tests/echo_server.cc @@ -12,22 +12,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "google/cloud/functions/framework.h" -#include -#include -#include +#include "google/cloud/functions/internal/framework_impl.h" +#include #include #include #include -#include namespace functions = ::google::cloud::functions; using functions::HttpRequest; using functions::HttpResponse; +std::atomic shutdown_server{false}; + HttpResponse EchoServer(HttpRequest const& request) { auto const& target = request.target(); - if (target == "/quit/program/0") std::exit(0); + if (target == "/quit/program/0") { + shutdown_server = true; + return HttpResponse{} + .set_header("Content-Type", "text/plain") + .set_payload("OK"); + } if (target.rfind("/exception/", 0) == 0) throw std::runtime_error(target); if (target.rfind("/unknown-exception/", 0) == 0) throw "uh-oh"; @@ -50,36 +54,24 @@ HttpResponse EchoServer(HttpRequest const& request) { std::clog << "stderr: " << target << "\n"; } - auto const sleep_prefix = std::string{"/sleep/"}; - if (target.rfind(sleep_prefix, 0) == 0) { - auto const delay = std::stoi(target.substr(sleep_prefix.size())); - std::this_thread::sleep_for(std::chrono::milliseconds(delay)); + std::ostringstream payload; + payload << "{\n" + << R"js( "target": ")js" << target << "\"\n" + << R"js( "verb": ")js" << request.verb() << "\"\n" + << R"js( "headers": [)js"; + for (auto [k, v] : request.headers()) { + payload << '"' << k << ": " << v << '"' << "\n"; } - - auto tid = [] { - std::ostringstream os; - os << std::this_thread::get_id(); - return std::move(os).str(); - }; - auto headers = [&] { - std::vector h(request.headers().size()); - std::transform(request.headers().begin(), request.headers().end(), - h.begin(), - [](auto const& kv) { return kv.first + ": " + kv.second; }); - return h; - }; - auto payload = nlohmann::json{ - {"thread", tid()}, - {"target", target}, - {"verb", request.verb()}, - {"headers", headers()}, - }; + payload << "}\n"; return HttpResponse{} .set_header("Content-Type", "application/json") - .set_payload(payload.dump(2)); + .set_payload(std::move(payload).str()); } int main(int argc, char* argv[]) { - return functions::Run(argc, argv, EchoServer); + return google::cloud::functions_internal::RunForTest( + argc, argv, EchoServer, + std::function{[] { return shutdown_server.load(); }}, + std::function([](int) {})); } diff --git a/google/cloud/functions/integration_tests/http_conformance.cc b/google/cloud/functions/integration_tests/http_conformance.cc index 84d9cdd6..e9e196d1 100644 --- a/google/cloud/functions/integration_tests/http_conformance.cc +++ b/google/cloud/functions/integration_tests/http_conformance.cc @@ -12,18 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "google/cloud/functions/framework.h" +#include "google/cloud/functions/internal/framework_impl.h" +#include #include namespace functions = ::google::cloud::functions; + +std::atomic shutdown_server{false}; + functions::HttpResponse HttpConformance(functions::HttpRequest const& request) { auto constexpr kOutputFilename = "function_output.json"; std::ofstream(kOutputFilename) << request.payload() << "\n"; // This is here just to gracefully shutdown and collect coverage data. - if (request.target() == "/quit/program/0") std::exit(0); + if (request.target() == "/quit/program/0") shutdown_server = true; return functions::HttpResponse{}; } int main(int argc, char* argv[]) { - return functions::Run(argc, argv, HttpConformance); + return google::cloud::functions_internal::RunForTest( + argc, argv, HttpConformance, + std::function{[] { return shutdown_server.load(); }}, + std::function([](int) {})); } From 946adc27fd4c759396845258e311652aa6b311c2 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 12 Aug 2021 21:47:58 +0000 Subject: [PATCH 6/6] Fix clang-tidy --- .../functions/integration_tests/cloud_event_conformance.cc | 5 ++--- .../cloud/functions/integration_tests/cloud_event_handler.cc | 5 ++--- google/cloud/functions/integration_tests/echo_server.cc | 5 ++--- google/cloud/functions/integration_tests/http_conformance.cc | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/google/cloud/functions/integration_tests/cloud_event_conformance.cc b/google/cloud/functions/integration_tests/cloud_event_conformance.cc index 44efaf54..ee9e9472 100644 --- a/google/cloud/functions/integration_tests/cloud_event_conformance.cc +++ b/google/cloud/functions/integration_tests/cloud_event_conformance.cc @@ -63,7 +63,6 @@ void CloudEventConformance(functions::CloudEvent const& ev) { int main(int argc, char* argv[]) { return google::cloud::functions_internal::RunForTest( - argc, argv, CloudEventConformance, - std::function{[] { return shutdown_server.load(); }}, - std::function([](int) {})); + argc, argv, CloudEventConformance, [] { return shutdown_server.load(); }, + [](int /*port*/) {}); } diff --git a/google/cloud/functions/integration_tests/cloud_event_handler.cc b/google/cloud/functions/integration_tests/cloud_event_handler.cc index 9e7d5ca5..9d0a18ab 100644 --- a/google/cloud/functions/integration_tests/cloud_event_handler.cc +++ b/google/cloud/functions/integration_tests/cloud_event_handler.cc @@ -38,7 +38,6 @@ void CloudEventHandler(CloudEvent const& event) { int main(int argc, char* argv[]) { return google::cloud::functions_internal::RunForTest( - argc, argv, CloudEventHandler, - std::function{[] { return shutdown_server.load(); }}, - std::function([](int) {})); + argc, argv, CloudEventHandler, [] { return shutdown_server.load(); }, + [](int /*port*/) {}); } diff --git a/google/cloud/functions/integration_tests/echo_server.cc b/google/cloud/functions/integration_tests/echo_server.cc index ecf491ad..09389232 100644 --- a/google/cloud/functions/integration_tests/echo_server.cc +++ b/google/cloud/functions/integration_tests/echo_server.cc @@ -71,7 +71,6 @@ HttpResponse EchoServer(HttpRequest const& request) { int main(int argc, char* argv[]) { return google::cloud::functions_internal::RunForTest( - argc, argv, EchoServer, - std::function{[] { return shutdown_server.load(); }}, - std::function([](int) {})); + argc, argv, EchoServer, [] { return shutdown_server.load(); }, + [](int /*port*/) {}); } diff --git a/google/cloud/functions/integration_tests/http_conformance.cc b/google/cloud/functions/integration_tests/http_conformance.cc index e9e196d1..2694d53e 100644 --- a/google/cloud/functions/integration_tests/http_conformance.cc +++ b/google/cloud/functions/integration_tests/http_conformance.cc @@ -30,7 +30,6 @@ functions::HttpResponse HttpConformance(functions::HttpRequest const& request) { int main(int argc, char* argv[]) { return google::cloud::functions_internal::RunForTest( - argc, argv, HttpConformance, - std::function{[] { return shutdown_server.load(); }}, - std::function([](int) {})); + argc, argv, HttpConformance, [] { return shutdown_server.load(); }, + [](int /*port*/) {}); }