diff options
author | 2015-11-04 00:19:09 -0800 | |
---|---|---|
committer | 2015-11-04 00:19:09 -0800 | |
commit | 780a7f205d81eb4a63a4040329b527c3082fbf79 (patch) | |
tree | 8298c4f8c1745becb6dcd0c91b25116627e6680b /test/cpp/qps/server.h | |
parent | d08a738166e7f293d4590bc852e102ebcbd2239d (diff) |
Add in security support, make payload protos configurable
Have not yet added tests with security support, coming soon
Diffstat (limited to 'test/cpp/qps/server.h')
-rw-r--r-- | test/cpp/qps/server.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index 12bbf1fef6..f4ae990022 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -35,7 +35,9 @@ #define TEST_QPS_SERVER_H #include <grpc/support/cpu.h> +#include <grpc++/security/server_credentials.h> +#include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/cpp/qps/timer.h" #include "test/proto/messages.grpc.pb.h" @@ -86,6 +88,18 @@ class Server { int Port() const {return port_;} int Cores() const {return gpr_cpu_num_cores();} + static std::shared_ptr<ServerCredentials> CreateServerCredentials(const ServerConfig &config) { + if (config.has_security_params()) { + SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, + test_server1_cert}; + SslServerCredentialsOptions ssl_opts; + ssl_opts.pem_root_certs = ""; + ssl_opts.pem_key_cert_pairs.push_back(pkcp); + return SslServerCredentials(ssl_opts); + } else { + return InsecureServerCredentials(); + } + } private: int port_; std::unique_ptr<Timer> timer_; |