aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/interop/interop_server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/cpp/interop/interop_server.cc')
-rw-r--r--test/cpp/interop/interop_server.cc32
1 files changed, 27 insertions, 5 deletions
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index f78a1f1d8a..f55d624b21 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -22,13 +22,13 @@
#include <thread>
#include <gflags/gflags.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server.h>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/server_context.h>
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/transport/byte_stream.h"
@@ -38,6 +38,8 @@
#include "test/cpp/interop/server_helper.h"
#include "test/cpp/util/test_config.h"
+DEFINE_bool(use_alts, false,
+ "Whether to use alts. Enable alts will disable tls.");
DEFINE_bool(use_tls, false, "Whether to use tls.");
DEFINE_string(custom_credentials_type, "", "User provided credentials type.");
DEFINE_int32(port, 0, "Server port.");
@@ -316,12 +318,27 @@ class TestServiceImpl : public TestService::Service {
void grpc::testing::interop::RunServer(
std::shared_ptr<ServerCredentials> creds) {
- RunServer(creds, FLAGS_port, nullptr);
+ RunServer(creds, FLAGS_port, nullptr, nullptr);
+}
+
+void grpc::testing::interop::RunServer(
+ std::shared_ptr<ServerCredentials> creds,
+ std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
+ server_options) {
+ RunServer(creds, FLAGS_port, nullptr, std::move(server_options));
}
void grpc::testing::interop::RunServer(
std::shared_ptr<ServerCredentials> creds, const int port,
ServerStartedCondition* server_started_condition) {
+ RunServer(creds, port, server_started_condition, nullptr);
+}
+
+void grpc::testing::interop::RunServer(
+ std::shared_ptr<ServerCredentials> creds, const int port,
+ ServerStartedCondition* server_started_condition,
+ std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>>
+ server_options) {
GPR_ASSERT(port != 0);
std::ostringstream server_address;
server_address << "0.0.0.0:" << port;
@@ -333,6 +350,11 @@ void grpc::testing::interop::RunServer(
ServerBuilder builder;
builder.RegisterService(&service);
builder.AddListeningPort(server_address.str(), creds);
+ if (server_options != nullptr) {
+ for (size_t i = 0; i < server_options->size(); i++) {
+ builder.SetOption(std::move((*server_options)[i]));
+ }
+ }
if (FLAGS_max_send_message_size >= 0) {
builder.SetMaxSendMessageSize(FLAGS_max_send_message_size);
}