|
|
|
@ -452,13 +452,18 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> { |
|
|
|
|
TestServiceImplDupPkg dup_pkg_service_; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) { |
|
|
|
|
static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs, |
|
|
|
|
bool with_binary_metadata) { |
|
|
|
|
EchoRequest request; |
|
|
|
|
EchoResponse response; |
|
|
|
|
request.set_message("Hello hello hello hello"); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < num_rpcs; ++i) { |
|
|
|
|
ClientContext context; |
|
|
|
|
if (with_binary_metadata) { |
|
|
|
|
char bytes[8] = {'\0', '\1', '\2', '\3', '\4', '\5', '\6', (char)i}; |
|
|
|
|
context.AddMetadata("custom-bin", grpc::string(bytes, 8)); |
|
|
|
|
} |
|
|
|
|
context.set_compression_algorithm(GRPC_COMPRESS_GZIP); |
|
|
|
|
Status s = stub->Echo(&context, request, &response); |
|
|
|
|
EXPECT_EQ(response.message(), request.message()); |
|
|
|
@ -466,6 +471,30 @@ static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(End2endTest, MultipleRpcsWithVariedBinaryMetadataValue) { |
|
|
|
|
ResetStub(); |
|
|
|
|
std::vector<std::thread*> threads; |
|
|
|
|
for (int i = 0; i < 10; ++i) { |
|
|
|
|
threads.push_back(new std::thread(SendRpc, stub_.get(), 10, true)); |
|
|
|
|
} |
|
|
|
|
for (int i = 0; i < 10; ++i) { |
|
|
|
|
threads[i]->join(); |
|
|
|
|
delete threads[i]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(End2endTest, MultipleRpcs) { |
|
|
|
|
ResetStub(); |
|
|
|
|
std::vector<std::thread*> threads; |
|
|
|
|
for (int i = 0; i < 10; ++i) { |
|
|
|
|
threads.push_back(new std::thread(SendRpc, stub_.get(), 10, false)); |
|
|
|
|
} |
|
|
|
|
for (int i = 0; i < 10; ++i) { |
|
|
|
|
threads[i]->join(); |
|
|
|
|
delete threads[i]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(End2endTest, RequestStreamOneRequest) { |
|
|
|
|
ResetStub(); |
|
|
|
|
EchoRequest request; |
|
|
|
@ -803,14 +832,14 @@ class ProxyEnd2endTest : public End2endTest { |
|
|
|
|
|
|
|
|
|
TEST_P(ProxyEnd2endTest, SimpleRpc) { |
|
|
|
|
ResetStub(); |
|
|
|
|
SendRpc(stub_.get(), 1); |
|
|
|
|
SendRpc(stub_.get(), 1, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST_P(ProxyEnd2endTest, MultipleRpcs) { |
|
|
|
|
ResetStub(); |
|
|
|
|
std::vector<std::thread*> threads; |
|
|
|
|
for (int i = 0; i < 10; ++i) { |
|
|
|
|
threads.push_back(new std::thread(SendRpc, stub_.get(), 10)); |
|
|
|
|
threads.push_back(new std::thread(SendRpc, stub_.get(), 10, false)); |
|
|
|
|
} |
|
|
|
|
for (int i = 0; i < 10; ++i) { |
|
|
|
|
threads[i]->join(); |
|
|
|
|