Make RPC type configurable
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index bf51e74..764fe13 100644
--- a/test/cpp/qps/qps_driver.cc
+++ b/test/cpp/qps/qps_driver.cc
@@ -42,6 +42,8 @@
// Common config
DEFINE_bool(enable_ssl, false, "Use SSL");
+DEFINE_string(rpc_type, "UNARY_TEST",
+ "Type of RPC: UNARY_TEST or STREAMING_TEST");
// Server config
DEFINE_int32(server_threads, 1, "Number of server threads");
@@ -59,6 +61,7 @@
using grpc::testing::ServerConfig;
using grpc::testing::ClientType;
using grpc::testing::ServerType;
+using grpc::testing::RpcType;
using grpc::testing::ResourceUsage;
using grpc::testing::sum;
@@ -73,6 +76,9 @@
grpc_init();
ParseCommandLineFlags(&argc, &argv, true);
+ RpcType rpc_type;
+ RpcType_Parse(FLAGS_rpc_type, &rpc_type);
+
ClientType client_type;
ServerType server_type;
GPR_ASSERT(ClientType_Parse(FLAGS_client_type, &client_type));
@@ -86,6 +92,7 @@
client_config.set_client_channels(FLAGS_client_channels);
client_config.set_payload_size(FLAGS_payload_size);
client_config.set_async_client_threads(FLAGS_async_client_threads);
+ client_config.set_rpc_type(rpc_type);
ServerConfig server_config;
server_config.set_server_type(server_type);
diff --git a/test/cpp/qps/qpstest.proto b/test/cpp/qps/qpstest.proto
index 70cc926..1553ef5 100644
--- a/test/cpp/qps/qpstest.proto
+++ b/test/cpp/qps/qpstest.proto
@@ -87,9 +87,9 @@
ASYNC_SERVER = 2;
}
-enum TestType {
- UNARY_TEST = 1;
- STREAMING_TEST = 2;
+enum RpcType {
+ UNARY = 1;
+ STREAMING = 2;
}
message ClientConfig {
@@ -101,7 +101,7 @@
required int32 payload_size = 6;
// only for async client:
optional int32 async_client_threads = 7;
- optional TestType test_type = 8 [default=UNARY_TEST];
+ optional RpcType rpc_type = 8 [default=UNARY];
}
// Request current stats
diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc
index 4c8c7cf..afe3ce9 100644
--- a/test/cpp/qps/worker.cc
+++ b/test/cpp/qps/worker.cc
@@ -77,11 +77,11 @@
std::unique_ptr<Client> CreateClient(const ClientConfig& config) {
switch (config.client_type()) {
case ClientType::SYNCHRONOUS_CLIENT:
- return (config.test_type() == TestType::UNARY_TEST) ?
+ return (config.rpc_type() == RpcType::UNARY) ?
CreateSynchronousUnaryClient(config) :
CreateSynchronousStreamingClient(config);
case ClientType::ASYNC_CLIENT:
- return (config.test_type() == TestType::UNARY_TEST) ?
+ return (config.rpc_type() == RpcType::UNARY) ?
CreateAsyncUnaryClient(config) : CreateAsyncStreamingClient(config);
}
abort();