aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/interop
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2017-01-11 11:10:43 -0800
committerGravatar yang-g <yangg@google.com>2017-01-11 11:10:43 -0800
commitcc5910228d84561d40cd8f0513faddc1e0100275 (patch)
tree930e2290e83bdaa04187ddc866982db354723801 /test/cpp/interop
parent3c42128a350f4e153cd3f098fa6b928addb99c58 (diff)
manual revert of #8901
Diffstat (limited to 'test/cpp/interop')
-rw-r--r--test/cpp/interop/client.cc1
-rw-r--r--test/cpp/interop/client_helper.cc10
-rw-r--r--test/cpp/interop/interop_server.cc1
-rw-r--r--test/cpp/interop/server_helper.cc18
-rw-r--r--test/cpp/interop/stress_test.cc1
5 files changed, 20 insertions, 11 deletions
diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc
index c58910abc3..3265554444 100644
--- a/test/cpp/interop/client.cc
+++ b/test/cpp/interop/client.cc
@@ -49,6 +49,7 @@
#include "test/cpp/util/test_config.h"
DEFINE_bool(use_tls, false, "Whether to use tls.");
+DEFINE_string(custom_credentials_type, "", "User provided credentials type.");
DEFINE_bool(use_test_ca, false, "False to use SSL roots for google");
DEFINE_int32(server_port, 0, "Server port.");
DEFINE_string(server_host, "127.0.0.1", "Server host to connect to");
diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc
index c171969e14..91564e5dce 100644
--- a/test/cpp/interop/client_helper.cc
+++ b/test/cpp/interop/client_helper.cc
@@ -50,8 +50,10 @@
#include "src/cpp/client/secure_credentials.h"
#include "test/core/security/oauth2_utils.h"
#include "test/cpp/util/create_test_channel.h"
+#include "test/cpp/util/test_credentials_provider.h"
DECLARE_bool(use_tls);
+DECLARE_string(custom_credentials_type);
DECLARE_bool(use_test_ca);
DECLARE_int32(server_port);
DECLARE_string(server_host);
@@ -114,8 +116,12 @@ std::shared_ptr<Channel> CreateChannelForTestCase(
creds = AccessTokenCredentials(raw_token);
GPR_ASSERT(creds);
}
- return CreateTestChannel(host_port, FLAGS_server_host_override, FLAGS_use_tls,
- !FLAGS_use_test_ca, creds);
+ if (FLAGS_custom_credentials_type.empty()) {
+ return CreateTestChannel(host_port, FLAGS_server_host_override,
+ FLAGS_use_tls, !FLAGS_use_test_ca, creds);
+ } else {
+ return CreateTestChannel(host_port, FLAGS_custom_credentials_type, creds);
+ }
}
} // namespace testing
diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc
index 67456ce18b..956840ba70 100644
--- a/test/cpp/interop/interop_server.cc
+++ b/test/cpp/interop/interop_server.cc
@@ -56,6 +56,7 @@
#include "test/cpp/util/test_config.h"
DEFINE_bool(use_tls, false, "Whether to use tls.");
+DEFINE_string(custom_credentials_type, "", "User provided credentials type.");
DEFINE_int32(port, 0, "Server port.");
DEFINE_int32(max_send_message_size, -1, "The maximum send message size.");
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index 8b0b511bcb..d395f50fa5 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -39,23 +39,23 @@
#include <grpc++/security/server_credentials.h>
#include "src/core/lib/surface/call_test_only.h"
-#include "test/core/end2end/data/ssl_test_data.h"
+#include "test/cpp/util/test_credentials_provider.h"
DECLARE_bool(use_tls);
+DECLARE_string(custom_credentials_type);
namespace grpc {
namespace testing {
std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
- if (FLAGS_use_tls) {
- 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);
+ if (!FLAGS_custom_credentials_type.empty()) {
+ return GetCredentialsProvider()->GetServerCredentials(
+ FLAGS_custom_credentials_type);
+ } else if (FLAGS_use_tls) {
+ return GetCredentialsProvider()->GetServerCredentials(kTlsCredentialsType);
} else {
- return InsecureServerCredentials();
+ return GetCredentialsProvider()->GetServerCredentials(
+ kInsecureCredentialsType);
}
}
diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc
index 97e658869f..562522de77 100644
--- a/test/cpp/interop/stress_test.cc
+++ b/test/cpp/interop/stress_test.cc
@@ -147,6 +147,7 @@ DEFINE_bool(do_not_abort_on_transient_failures, true,
// Options from client.cc (for compatibility with interop test).
// TODO(sreek): Consolidate overlapping options
DEFINE_bool(use_tls, false, "Whether to use tls.");
+DEFINE_string(custom_credentials_type, "", "User provided credentials type.");
DEFINE_bool(use_test_ca, false, "False to use SSL roots for google");
DEFINE_int32(server_port, 0, "Server port.");
DEFINE_string(server_host, "127.0.0.1", "Server host to connect to");