Add a helper to return all the secure types

pull/5318/head
yang-g 9 years ago
parent 17197ddc71
commit 4c8aed3dba
  1. 51
      test/cpp/end2end/end2end_test.cc
  2. 6
      test/cpp/util/test_credentials_provider.cc
  3. 3
      test/cpp/util/test_credentials_provider.h

@ -1365,25 +1365,42 @@ TEST_P(SecureEnd2endTest, ClientAuthContext) {
EXPECT_EQ("*.test.youtube.com", ToString(auth_ctx->GetPeerIdentity()[2])); EXPECT_EQ("*.test.youtube.com", ToString(auth_ctx->GetPeerIdentity()[2]));
} }
INSTANTIATE_TEST_CASE_P( std::vector<TestScenario> CreateTestScenarios(bool use_proxy,
End2end, End2endTest, bool test_insecure,
::testing::Values(TestScenario(false, kInsecureCredentialsType), bool test_secure) {
TestScenario(false, kTlsCredentialsType))); std::vector<TestScenario> scenarios;
std::vector<grpc::string> credentials_types;
INSTANTIATE_TEST_CASE_P( if (test_secure) {
End2endServerTryCancel, End2endServerTryCancelTest, credentials_types = GetSecureCredentialsTypeList();
::testing::Values(TestScenario(false, kInsecureCredentialsType))); }
if (test_insecure) {
INSTANTIATE_TEST_CASE_P( credentials_types.push_back(kInsecureCredentialsType);
ProxyEnd2end, ProxyEnd2endTest, }
::testing::Values(TestScenario(false, kInsecureCredentialsType), for (auto it = credentials_types.begin(); it != credentials_types.end();
TestScenario(false, kTlsCredentialsType), ++it) {
TestScenario(true, kInsecureCredentialsType), scenarios.push_back(TestScenario(false, *it));
TestScenario(true, kTlsCredentialsType))); if (use_proxy) {
scenarios.push_back(TestScenario(true, *it));
}
}
return scenarios;
}
INSTANTIATE_TEST_CASE_P(End2end, End2endTest,
::testing::ValuesIn(CreateTestScenarios(false, true,
true)));
INSTANTIATE_TEST_CASE_P(End2endServerTryCancel, End2endServerTryCancelTest,
::testing::ValuesIn(CreateTestScenarios(false, true,
false)));
INSTANTIATE_TEST_CASE_P(ProxyEnd2end, ProxyEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(true, true,
true)));
INSTANTIATE_TEST_CASE_P(SecureEnd2end, SecureEnd2endTest, INSTANTIATE_TEST_CASE_P(SecureEnd2end, SecureEnd2endTest,
::testing::Values(TestScenario(false, ::testing::ValuesIn(CreateTestScenarios(false, false,
kTlsCredentialsType))); true)));
} // namespace } // namespace
} // namespace testing } // namespace testing

@ -70,5 +70,11 @@ std::shared_ptr<ServerCredentials> GetServerCredentials(
return nullptr; return nullptr;
} }
std::vector<grpc::string> GetSecureCredentialsTypeList() {
std::vector<grpc::string> types;
types.push_back(kTlsCredentialsType);
return types;
}
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc

@ -55,6 +55,9 @@ std::shared_ptr<ChannelCredentials> GetChannelCredentials(
std::shared_ptr<ServerCredentials> GetServerCredentials( std::shared_ptr<ServerCredentials> GetServerCredentials(
const grpc::string& type); const grpc::string& type);
// Provide a list of secure credentials type.
std::vector<grpc::string> GetSecureCredentialsTypeList();
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc

Loading…
Cancel
Save