diff options
Diffstat (limited to 'test/cpp/end2end')
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index b1d3ce92f6..a94ed4d8da 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -37,6 +37,7 @@ #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> +#include <grpc++/resource_quota.h> #include <grpc++/security/auth_metadata_processor.h> #include <grpc++/security/credentials.h> #include <grpc++/security/server_credentials.h> @@ -240,6 +241,7 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> { server_address_ << "127.0.0.1:" << port; // Setup server ServerBuilder builder; + ConfigureServerBuilder(&builder); auto server_creds = GetServerCredentials(GetParam().credentials_type); if (GetParam().credentials_type != kInsecureCredentialsType) { server_creds->SetAuthMetadataProcessor(processor); @@ -247,13 +249,16 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> { builder.AddListeningPort(server_address_.str(), server_creds); builder.RegisterService(&service_); builder.RegisterService("foo.test.youtube.com", &special_service_); - builder.SetMaxMessageSize( - kMaxMessageSize_); // For testing max message size. builder.RegisterService(&dup_pkg_service_); server_ = builder.BuildAndStart(); is_server_started_ = true; } + virtual void ConfigureServerBuilder(ServerBuilder* builder) { + builder->SetMaxMessageSize( + kMaxMessageSize_); // For testing max message size. + } + void ResetChannel() { if (!is_server_started_) { StartServer(std::shared_ptr<AuthMetadataProcessor>()); @@ -1476,6 +1481,32 @@ TEST_P(SecureEnd2endTest, ClientAuthContext) { } } +class ResourceQuotaEnd2endTest : public End2endTest { + public: + ResourceQuotaEnd2endTest() + : server_resource_quota_("server_resource_quota") {} + + virtual void ConfigureServerBuilder(ServerBuilder* builder) GRPC_OVERRIDE { + builder->SetResourceQuota(server_resource_quota_); + } + + private: + ResourceQuota server_resource_quota_; +}; + +TEST_P(ResourceQuotaEnd2endTest, SimpleRequest) { + ResetStub(); + + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + + ClientContext context; + Status s = stub_->Echo(&context, request, &response); + EXPECT_EQ(response.message(), request.message()); + EXPECT_TRUE(s.ok()); +} + std::vector<TestScenario> CreateTestScenarios(bool use_proxy, bool test_insecure, bool test_secure) { @@ -1513,6 +1544,10 @@ INSTANTIATE_TEST_CASE_P(SecureEnd2end, SecureEnd2endTest, ::testing::ValuesIn(CreateTestScenarios(false, false, true))); +INSTANTIATE_TEST_CASE_P(ResourceQuotaEnd2end, ResourceQuotaEnd2endTest, + ::testing::ValuesIn(CreateTestScenarios(false, true, + true))); + } // namespace } // namespace testing } // namespace grpc |