Add a simple test

pull/12574/head
yang-g 7 years ago
parent cfd20c4262
commit 3c00328b62
  1. 28
      test/cpp/end2end/end2end_test.cc

@ -1673,6 +1673,34 @@ TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginFailure) {
kTestCredsPluginErrorMsg);
}
TEST_P(SecureEnd2endTest, CompositeCallCreds) {
ResetStub();
EchoRequest request;
EchoResponse response;
ClientContext context;
const char kMetadataKey1[] = "call-creds-key1";
const char kMetadataKey2[] = "call-creds-key2";
const char kMetadataVal1[] = "call-creds-val1";
const char kMetadataVal2[] = "call-creds-val2";
context.set_credentials(CompositeCallCredentials(
MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
new TestMetadataCredentialsPlugin(kMetadataKey1, kMetadataVal1, true,
true))),
MetadataCredentialsFromPlugin(std::unique_ptr<MetadataCredentialsPlugin>(
new TestMetadataCredentialsPlugin(kMetadataKey2, kMetadataVal2, true,
true)))));
request.set_message("Hello");
request.mutable_param()->set_echo_metadata(true);
Status s = stub_->Echo(&context, request, &response);
EXPECT_TRUE(s.ok());
EXPECT_TRUE(MetadataContains(context.GetServerTrailingMetadata(),
kMetadataKey1, kMetadataVal1));
EXPECT_TRUE(MetadataContains(context.GetServerTrailingMetadata(),
kMetadataKey2, kMetadataVal2));
}
TEST_P(SecureEnd2endTest, ClientAuthContext) {
ResetStub();
EchoRequest request;

Loading…
Cancel
Save