diff options
Diffstat (limited to 'test')
54 files changed, 243 insertions, 1129 deletions
diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index c0bea7bb36..9ff46d62e4 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -1,8 +1,7 @@ - /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -259,7 +258,7 @@ void grpc_end2end_tests(int argc, char **argv, trailing_metadata(config); continue; } - gpr_log(GPR_DEBUG, "not a test: '%%s'", argv[i]); + gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); abort(); } } diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 4c3a018ad2..397ff446a9 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -1,8 +1,7 @@ - /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -265,7 +264,7 @@ void grpc_end2end_tests(int argc, char **argv, trailing_metadata(config); continue; } - gpr_log(GPR_DEBUG, "not a test: '%%s'", argv[i]); + gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); abort(); } } diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 0aeec27654..e0136b3cd7 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -389,7 +389,8 @@ void on_fd_released(grpc_exec_ctx *exec_ctx, void *arg, int success) { grpc_pollset_kick(&g_pollset, NULL); } -/* Do a read_test, then release fd and try to read/write again. */ +/* Do a read_test, then release fd and try to read/write again. Verify that + grpc_tcp_fd() is available before the fd is released. */ static void release_fd_test(size_t num_bytes, size_t slice_size) { int sv[2]; grpc_endpoint *ep; @@ -408,6 +409,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), slice_size, "test"); + GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0); grpc_endpoint_add_to_pollset(&exec_ctx, ep, &g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c index 9f37e0374c..f396398cef 100644 --- a/test/core/security/jwt_verifier_test.c +++ b/test/core/security/jwt_verifier_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/support/alloc_test.c b/test/core/support/alloc_test.c index ea6306c1f9..a7051a46a1 100644 --- a/test/core/support/alloc_test.c +++ b/test/core/support/alloc_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/support/cpu_test.c b/test/core/support/cpu_test.c index f041166d08..da16f13fd8 100644 --- a/test/core/support/cpu_test.c +++ b/test/core/support/cpu_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,15 +72,15 @@ struct cpu_test { uint32_t ncores; int is_done; gpr_cv done_cv; - int *used; /* is this core used? */ - int r; /* random number */ + int *used; /* is this core used? */ + unsigned r; /* random number */ }; static void worker_thread(void *arg) { struct cpu_test *ct = (struct cpu_test *)arg; uint32_t cpu; - int r = 12345678; - int i, j; + unsigned r = 12345678; + unsigned i, j; for (i = 0; i < 1000 / GRPC_TEST_SLOWDOWN_FACTOR; i++) { /* run for a bit - just calculate something random. */ for (j = 0; j < 1000000 / GRPC_TEST_SLOWDOWN_FACTOR; j++) { @@ -90,7 +90,13 @@ static void worker_thread(void *arg) { GPR_ASSERT(cpu < ct->ncores); gpr_mu_lock(&ct->mu); ct->used[cpu] = 1; + for (j = 0; j < ct->ncores; j++) { + if (!ct->used[j]) break; + } gpr_mu_unlock(&ct->mu); + if (j == ct->ncores) { + break; /* all cpus have been used - no further use in running this test */ + } } gpr_mu_lock(&ct->mu); ct->r = r; /* make it look like we care about r's value... */ diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index 4a3ffbd09e..1e1524d098 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -58,6 +58,4 @@ #include <grpc/support/tls.h> #include <grpc/support/useful.h> -int main(int argc, char **argv) { - return 0; -} +int main(int argc, char **argv) { return 0; } diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 3acbfd55c2..320a064592 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,16 +46,16 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" #ifdef GPR_POSIX_SOCKET #include "src/core/iomgr/pollset_posix.h" #endif -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; using std::chrono::system_clock; namespace grpc { @@ -201,7 +201,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> { void ResetStub() { std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), InsecureChannelCredentials()); - stub_ = grpc::cpp::test::util::TestService::NewStub(channel); + stub_ = grpc::testing::TestService::NewStub(channel); } void SendRpc(int num_rpcs) { @@ -239,9 +239,9 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> { } std::unique_ptr<ServerCompletionQueue> cq_; - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server_; - grpc::cpp::test::util::TestService::AsyncService service_; + grpc::testing::TestService::AsyncService service_; std::ostringstream server_address_; }; @@ -751,8 +751,8 @@ TEST_P(AsyncEnd2endTest, ServerCheckDone) { TEST_P(AsyncEnd2endTest, UnimplementedRpc) { std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), InsecureChannelCredentials()); - std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub; - stub = grpc::cpp::test::util::UnimplementedService::NewStub(channel); + std::unique_ptr<grpc::testing::UnimplementedService::Stub> stub; + stub = grpc::testing::UnimplementedService::NewStub(channel); EchoRequest send_request; EchoResponse recv_response; Status recv_status; diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 116785bbf2..68c63b2f93 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -44,12 +44,12 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/subprocess.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; using std::chrono::system_clock; static std::string g_root; @@ -63,8 +63,7 @@ class CrashTest : public ::testing::Test { protected: CrashTest() {} - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> - CreateServerAndStub() { + std::unique_ptr<grpc::testing::TestService::Stub> CreateServerAndStub() { auto port = grpc_pick_unused_port_or_die(); std::ostringstream addr_stream; addr_stream << "localhost:" << port; @@ -73,7 +72,7 @@ class CrashTest : public ::testing::Test { g_root + "/client_crash_test_server", "--address=" + addr, })); GPR_ASSERT(server_); - return grpc::cpp::test::util::TestService::NewStub( + return grpc::testing::TestService::NewStub( CreateChannel(addr, InsecureChannelCredentials())); } diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc index 7ffeecca70..f9a9c187a7 100644 --- a/test/cpp/end2end/client_crash_test_server.cc +++ b/test/cpp/end2end/client_crash_test_server.cc @@ -39,12 +39,12 @@ #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" DEFINE_string(address, "", "Address to bind to"); -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. @@ -56,8 +56,7 @@ using namespace gflags; namespace grpc { namespace testing { -class ServiceImpl GRPC_FINAL - : public ::grpc::cpp::test::util::TestService::Service { +class ServiceImpl GRPC_FINAL : public ::grpc::testing::TestService::Service { Status BidiStream(ServerContext* context, ServerReaderWriter<EchoResponse, EchoRequest>* stream) GRPC_OVERRIDE { diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index bbeac7a30b..28f8a8ec46 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -52,12 +52,12 @@ #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; using std::chrono::system_clock; namespace grpc { @@ -196,10 +196,10 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor { const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll"; const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity"; -class Proxy : public ::grpc::cpp::test::util::TestService::Service { +class Proxy : public ::grpc::testing::TestService::Service { public: Proxy(std::shared_ptr<Channel> channel) - : stub_(grpc::cpp::test::util::TestService::NewStub(channel)) {} + : stub_(grpc::testing::TestService::NewStub(channel)) {} Status Echo(ServerContext* server_context, const EchoRequest* request, EchoResponse* response) GRPC_OVERRIDE { @@ -209,10 +209,10 @@ class Proxy : public ::grpc::cpp::test::util::TestService::Service { } private: - std::unique_ptr< ::grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr< ::grpc::testing::TestService::Stub> stub_; }; -class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { +class TestServiceImpl : public ::grpc::testing::TestService::Service { public: TestServiceImpl() : signal_client_(false), host_() {} explicit TestServiceImpl(const grpc::string& host) @@ -344,7 +344,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { }; class TestServiceImplDupPkg - : public ::grpc::cpp::test::util::duplicate::TestService::Service { + : public ::grpc::testing::duplicate::TestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) GRPC_OVERRIDE { @@ -435,12 +435,12 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> { channel_ = CreateChannel(proxyaddr.str(), InsecureChannelCredentials()); } - stub_ = grpc::cpp::test::util::TestService::NewStub(channel_); + stub_ = grpc::testing::TestService::NewStub(channel_); } bool is_server_started_; std::shared_ptr<Channel> channel_; - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::unique_ptr<Server> proxy_server_; std::unique_ptr<Proxy> proxy_service_; @@ -451,8 +451,7 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> { TestServiceImplDupPkg dup_pkg_service_; }; -static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub, - int num_rpcs) { +static void SendRpc(grpc::testing::TestService::Stub* stub, int num_rpcs) { EchoRequest request; EchoResponse response; request.set_message("Hello hello hello hello"); @@ -562,9 +561,8 @@ TEST_P(End2endTest, DiffPackageServices) { EXPECT_EQ(response.message(), request.message()); EXPECT_TRUE(s.ok()); - std::unique_ptr<grpc::cpp::test::util::duplicate::TestService::Stub> - dup_pkg_stub( - grpc::cpp::test::util::duplicate::TestService::NewStub(channel_)); + std::unique_ptr<grpc::testing::duplicate::TestService::Stub> dup_pkg_stub( + grpc::testing::duplicate::TestService::NewStub(channel_)); ClientContext context2; s = dup_pkg_stub->Echo(&context2, request, &response); EXPECT_EQ("no package", response.message()); @@ -783,8 +781,8 @@ TEST_P(End2endTest, ChannelStateTimeout) { // Talking to a non-existing service. TEST_P(End2endTest, NonExistingService) { ResetChannel(); - std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub; - stub = grpc::cpp::test::util::UnimplementedService::NewStub(channel_); + std::unique_ptr<grpc::testing::UnimplementedService::Stub> stub; + stub = grpc::testing::UnimplementedService::NewStub(channel_); EchoRequest request; EchoResponse response; diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 350e67b523..14b534fbd2 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,10 +50,10 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; using std::chrono::system_clock; namespace grpc { @@ -193,7 +193,7 @@ class GenericEnd2endTest : public ::testing::Test { CompletionQueue cli_cq_; std::unique_ptr<ServerCompletionQueue> srv_cq_; - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<grpc::GenericStub> generic_stub_; std::unique_ptr<Server> server_; AsyncGenericService generic_service_; diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index bd34cfba67..dddd1d0a2e 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -46,12 +46,12 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; -using grpc::cpp::test::util::TestService; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; +using grpc::testing::TestService; using std::chrono::system_clock; namespace grpc { @@ -245,10 +245,10 @@ class MockTest : public ::testing::Test { void ResetStub() { std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), InsecureChannelCredentials()); - stub_ = grpc::cpp::test::util::TestService::NewStub(channel); + stub_ = grpc::testing::TestService::NewStub(channel); } - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; TestServiceImpl service_; diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index 4b6793abe6..87ce6369d2 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -44,12 +44,12 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo.grpc.pb.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "test/cpp/util/subprocess.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; using std::chrono::system_clock; static std::string g_root; @@ -59,8 +59,7 @@ namespace testing { namespace { -class ServiceImpl GRPC_FINAL - : public ::grpc::cpp::test::util::TestService::Service { +class ServiceImpl GRPC_FINAL : public ::grpc::testing::TestService::Service { public: ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {} diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 2baefcbf42..b349ae7357 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -40,13 +40,13 @@ #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" DEFINE_string(address, "", "Address to connect to"); DEFINE_string(mode, "", "Test mode to use"); -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. @@ -57,7 +57,7 @@ using namespace gflags; int main(int argc, char** argv) { ParseCommandLineFlags(&argc, &argv, true); - auto stub = grpc::cpp::test::util::TestService::NewStub( + auto stub = grpc::testing::TestService::NewStub( grpc::CreateChannel(FLAGS_address, grpc::InsecureChannelCredentials())); EchoRequest request; diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index b1b18b2a7f..50d4f6dca3 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -46,15 +46,15 @@ #include "src/core/support/env.h" #include "test/core/util/test_config.h" #include "test/core/util/port.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; namespace grpc { namespace testing { -class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { +class TestServiceImpl : public ::grpc::testing::TestService::Service { public: explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {} @@ -94,7 +94,7 @@ class ShutdownTest : public ::testing::Test { void ResetStub() { string target = "dns:localhost:" + to_string(port_); channel_ = CreateChannel(target, InsecureChannelCredentials()); - stub_ = grpc::cpp::test::util::TestService::NewStub(channel_); + stub_ = grpc::testing::TestService::NewStub(channel_); } string to_string(const int number) { @@ -115,7 +115,7 @@ class ShutdownTest : public ::testing::Test { protected: std::shared_ptr<Channel> channel_; - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server_; bool shutdown_; int port_; diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index b7e103a1ae..ca563472a7 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -51,11 +51,11 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; using std::chrono::system_clock; const char* kLargeString = @@ -99,7 +99,7 @@ const char* kLargeString = namespace grpc { namespace testing { -class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { +class TestServiceImpl : public ::grpc::testing::TestService::Service { public: static void BidiStream_Sender( ServerReaderWriter<EchoResponse, EchoRequest>* stream, @@ -161,10 +161,10 @@ class End2endTest : public ::testing::Test { void ResetStub() { std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), InsecureChannelCredentials()); - stub_ = grpc::cpp::test::util::TestService::NewStub(channel); + stub_ = grpc::testing::TestService::NewStub(channel); } - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; TestServiceImpl service_; diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index fb82b96135..8efc645fa3 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -47,11 +47,11 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo_duplicate.grpc.pb.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; using std::chrono::system_clock; namespace grpc { @@ -74,7 +74,7 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request, } // namespace -class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { +class TestServiceImpl : public ::grpc::testing::TestService::Service { public: TestServiceImpl() : signal_client_(false) {} @@ -159,7 +159,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { }; class TestServiceImplDupPkg - : public ::grpc::cpp::test::util::duplicate::TestService::Service { + : public ::grpc::testing::duplicate::TestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) GRPC_OVERRIDE { @@ -191,10 +191,10 @@ class End2endTest : public ::testing::Test { void ResetStub() { std::shared_ptr<Channel> channel = CreateChannel(server_address_.str(), InsecureChannelCredentials()); - stub_ = grpc::cpp::test::util::TestService::NewStub(channel); + stub_ = grpc::testing::TestService::NewStub(channel); } - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; const int kMaxMessageSize_; @@ -202,8 +202,7 @@ class End2endTest : public ::testing::Test { TestServiceImplDupPkg dup_pkg_service_; }; -static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub, - int num_rpcs) { +static void SendRpc(grpc::testing::TestService::Stub* stub, int num_rpcs) { EchoRequest request; EchoResponse response; request.set_message("Hello"); diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index 41482717d2..802df6bb94 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -44,17 +44,16 @@ #include "test/core/util/test_config.h" #include "test/core/util/port.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "src/core/support/env.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; namespace grpc { namespace testing { -class ZookeeperTestServiceImpl - : public ::grpc::cpp::test::util::TestService::Service { +class ZookeeperTestServiceImpl : public ::grpc::testing::TestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) GRPC_OVERRIDE { @@ -158,7 +157,7 @@ class ZookeeperTest : public ::testing::Test { void ResetStub() { string target = "zookeeper://" + zookeeper_address_ + "/test"; channel_ = CreateChannel(target, InsecureChannelCredentials()); - stub_ = grpc::cpp::test::util::TestService::NewStub(channel_); + stub_ = grpc::testing::TestService::NewStub(channel_); } string to_string(const int number) { @@ -168,7 +167,7 @@ class ZookeeperTest : public ::testing::Test { } std::shared_ptr<Channel> channel_; - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server1_; std::unique_ptr<Server> server2_; ZookeeperTestServiceImpl service_; diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 05ef0c8d9d..b06310781a 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,19 +38,19 @@ #include <fstream> #include <memory> +#include <grpc++/channel.h> +#include <grpc++/client_context.h> +#include <grpc++/security/credentials.h> #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/useful.h> -#include <grpc++/channel.h> -#include <grpc++/client_context.h> -#include <grpc++/security/credentials.h> #include "src/core/transport/byte_stream.h" +#include "src/proto/grpc/testing/empty.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "src/proto/grpc/testing/messages.grpc.pb.h" #include "test/cpp/interop/client_helper.h" -#include "test/proto/test.grpc.pb.h" -#include "test/proto/empty.grpc.pb.h" -#include "test/proto/messages.grpc.pb.h" namespace grpc { namespace testing { @@ -145,13 +145,13 @@ void InteropClient::AssertOkOrPrintErrorStatus(const Status& s) { if (s.ok()) { return; } - gpr_log(GPR_INFO, "Error status code: %d, message: %s", s.error_code(), + gpr_log(GPR_ERROR, "Error status code: %d, message: %s", s.error_code(), s.error_message().c_str()); GPR_ASSERT(0); } void InteropClient::DoEmpty() { - gpr_log(GPR_INFO, "Sending an empty rpc..."); + gpr_log(GPR_DEBUG, "Sending an empty rpc..."); Empty request = Empty::default_instance(); Empty response = Empty::default_instance(); @@ -160,7 +160,7 @@ void InteropClient::DoEmpty() { Status s = serviceStub_.Get()->EmptyCall(&context, request, &response); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "Empty rpc done."); + gpr_log(GPR_DEBUG, "Empty rpc done."); } void InteropClient::PerformLargeUnary(SimpleRequest* request, @@ -208,7 +208,7 @@ void InteropClient::PerformLargeUnary(SimpleRequest* request, void InteropClient::DoComputeEngineCreds( const grpc::string& default_service_account, const grpc::string& oauth_scope) { - gpr_log(GPR_INFO, + gpr_log(GPR_DEBUG, "Sending a large unary rpc with compute engine credentials ..."); SimpleRequest request; SimpleResponse response; @@ -216,19 +216,19 @@ void InteropClient::DoComputeEngineCreds( request.set_fill_oauth_scope(true); request.set_response_type(PayloadType::COMPRESSABLE); PerformLargeUnary(&request, &response); - gpr_log(GPR_INFO, "Got username %s", response.username().c_str()); - gpr_log(GPR_INFO, "Got oauth_scope %s", response.oauth_scope().c_str()); + gpr_log(GPR_DEBUG, "Got username %s", response.username().c_str()); + gpr_log(GPR_DEBUG, "Got oauth_scope %s", response.oauth_scope().c_str()); GPR_ASSERT(!response.username().empty()); GPR_ASSERT(response.username().c_str() == default_service_account); GPR_ASSERT(!response.oauth_scope().empty()); const char* oauth_scope_str = response.oauth_scope().c_str(); GPR_ASSERT(oauth_scope.find(oauth_scope_str) != grpc::string::npos); - gpr_log(GPR_INFO, "Large unary with compute engine creds done."); + gpr_log(GPR_DEBUG, "Large unary with compute engine creds done."); } void InteropClient::DoOauth2AuthToken(const grpc::string& username, const grpc::string& oauth_scope) { - gpr_log(GPR_INFO, + gpr_log(GPR_DEBUG, "Sending a unary rpc with raw oauth2 access token credentials ..."); SimpleRequest request; SimpleResponse response; @@ -245,11 +245,11 @@ void InteropClient::DoOauth2AuthToken(const grpc::string& username, GPR_ASSERT(username == response.username()); const char* oauth_scope_str = response.oauth_scope().c_str(); GPR_ASSERT(oauth_scope.find(oauth_scope_str) != grpc::string::npos); - gpr_log(GPR_INFO, "Unary with oauth2 access token credentials done."); + gpr_log(GPR_DEBUG, "Unary with oauth2 access token credentials done."); } void InteropClient::DoPerRpcCreds(const grpc::string& json_key) { - gpr_log(GPR_INFO, "Sending a unary rpc with per-rpc JWT access token ..."); + gpr_log(GPR_DEBUG, "Sending a unary rpc with per-rpc JWT access token ..."); SimpleRequest request; SimpleResponse response; request.set_fill_username(true); @@ -266,11 +266,12 @@ void InteropClient::DoPerRpcCreds(const grpc::string& json_key) { AssertOkOrPrintErrorStatus(s); GPR_ASSERT(!response.username().empty()); GPR_ASSERT(json_key.find(response.username()) != grpc::string::npos); - gpr_log(GPR_INFO, "Unary with per-rpc JWT access token done."); + gpr_log(GPR_DEBUG, "Unary with per-rpc JWT access token done."); } void InteropClient::DoJwtTokenCreds(const grpc::string& username) { - gpr_log(GPR_INFO, "Sending a large unary rpc with JWT token credentials ..."); + gpr_log(GPR_DEBUG, + "Sending a large unary rpc with JWT token credentials ..."); SimpleRequest request; SimpleResponse response; request.set_fill_username(true); @@ -278,16 +279,16 @@ void InteropClient::DoJwtTokenCreds(const grpc::string& username) { PerformLargeUnary(&request, &response); GPR_ASSERT(!response.username().empty()); GPR_ASSERT(username.find(response.username()) != grpc::string::npos); - gpr_log(GPR_INFO, "Large unary with JWT token creds done."); + gpr_log(GPR_DEBUG, "Large unary with JWT token creds done."); } void InteropClient::DoLargeUnary() { - gpr_log(GPR_INFO, "Sending a large unary rpc..."); + gpr_log(GPR_DEBUG, "Sending a large unary rpc..."); SimpleRequest request; SimpleResponse response; request.set_response_type(PayloadType::COMPRESSABLE); PerformLargeUnary(&request, &response); - gpr_log(GPR_INFO, "Large unary done."); + gpr_log(GPR_DEBUG, "Large unary done."); } void InteropClient::DoLargeCompressedUnary() { @@ -300,20 +301,21 @@ void InteropClient::DoLargeCompressedUnary() { CompressionType_Name(compression_types[j]).c_str(), PayloadType_Name(payload_types[i]).c_str()); - gpr_log(GPR_INFO, "Sending a large compressed unary rpc %s.", log_suffix); + gpr_log(GPR_DEBUG, "Sending a large compressed unary rpc %s.", + log_suffix); SimpleRequest request; SimpleResponse response; request.set_response_type(payload_types[i]); request.set_response_compression(compression_types[j]); PerformLargeUnary(&request, &response, CompressionChecks); - gpr_log(GPR_INFO, "Large compressed unary done %s.", log_suffix); + gpr_log(GPR_DEBUG, "Large compressed unary done %s.", log_suffix); gpr_free(log_suffix); } } } void InteropClient::DoRequestStreaming() { - gpr_log(GPR_INFO, "Sending request steaming rpc ..."); + gpr_log(GPR_DEBUG, "Sending request steaming rpc ..."); ClientContext context; StreamingInputCallRequest request; @@ -334,11 +336,11 @@ void InteropClient::DoRequestStreaming() { GPR_ASSERT(response.aggregated_payload_size() == aggregated_payload_size); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "Request streaming done."); + gpr_log(GPR_DEBUG, "Request streaming done."); } void InteropClient::DoResponseStreaming() { - gpr_log(GPR_INFO, "Receiving response steaming rpc ..."); + gpr_log(GPR_DEBUG, "Receiving response steaming rpc ..."); ClientContext context; StreamingOutputCallRequest request; @@ -359,7 +361,7 @@ void InteropClient::DoResponseStreaming() { GPR_ASSERT(response_stream_sizes.size() == i); Status s = stream->Finish(); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "Response streaming done."); + gpr_log(GPR_DEBUG, "Response streaming done."); } void InteropClient::DoResponseCompressedStreaming() { @@ -376,7 +378,7 @@ void InteropClient::DoResponseCompressedStreaming() { CompressionType_Name(compression_types[j]).c_str(), PayloadType_Name(payload_types[i]).c_str()); - gpr_log(GPR_INFO, "Receiving response steaming rpc %s.", log_suffix); + gpr_log(GPR_DEBUG, "Receiving response steaming rpc %s.", log_suffix); request.set_response_type(payload_types[i]); request.set_response_compression(compression_types[j]); @@ -434,14 +436,14 @@ void InteropClient::DoResponseCompressedStreaming() { Status s = stream->Finish(); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "Response streaming done %s.", log_suffix); + gpr_log(GPR_DEBUG, "Response streaming done %s.", log_suffix); gpr_free(log_suffix); } } } void InteropClient::DoResponseStreamingWithSlowConsumer() { - gpr_log(GPR_INFO, "Receiving response steaming rpc with slow consumer ..."); + gpr_log(GPR_DEBUG, "Receiving response steaming rpc with slow consumer ..."); ClientContext context; StreamingOutputCallRequest request; @@ -458,7 +460,7 @@ void InteropClient::DoResponseStreamingWithSlowConsumer() { while (stream->Read(&response)) { GPR_ASSERT(response.payload().body() == grpc::string(kResponseMessageSize, '\0')); - gpr_log(GPR_INFO, "received message %d", i); + gpr_log(GPR_DEBUG, "received message %d", i); usleep(kReceiveDelayMilliSeconds * 1000); ++i; } @@ -466,11 +468,11 @@ void InteropClient::DoResponseStreamingWithSlowConsumer() { Status s = stream->Finish(); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "Response streaming done."); + gpr_log(GPR_DEBUG, "Response streaming done."); } void InteropClient::DoHalfDuplex() { - gpr_log(GPR_INFO, "Sending half-duplex streaming rpc ..."); + gpr_log(GPR_DEBUG, "Sending half-duplex streaming rpc ..."); ClientContext context; std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, @@ -495,11 +497,11 @@ void InteropClient::DoHalfDuplex() { GPR_ASSERT(response_stream_sizes.size() == i); Status s = stream->Finish(); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "Half-duplex streaming rpc done."); + gpr_log(GPR_DEBUG, "Half-duplex streaming rpc done."); } void InteropClient::DoPingPong() { - gpr_log(GPR_INFO, "Sending Ping Pong streaming rpc ..."); + gpr_log(GPR_DEBUG, "Sending Ping Pong streaming rpc ..."); ClientContext context; std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, @@ -524,11 +526,11 @@ void InteropClient::DoPingPong() { GPR_ASSERT(!stream->Read(&response)); Status s = stream->Finish(); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "Ping pong streaming done."); + gpr_log(GPR_DEBUG, "Ping pong streaming done."); } void InteropClient::DoCancelAfterBegin() { - gpr_log(GPR_INFO, "Sending request steaming rpc ..."); + gpr_log(GPR_DEBUG, "Sending request steaming rpc ..."); ClientContext context; StreamingInputCallRequest request; @@ -537,15 +539,15 @@ void InteropClient::DoCancelAfterBegin() { std::unique_ptr<ClientWriter<StreamingInputCallRequest>> stream( serviceStub_.Get()->StreamingInputCall(&context, &response)); - gpr_log(GPR_INFO, "Trying to cancel..."); + gpr_log(GPR_DEBUG, "Trying to cancel..."); context.TryCancel(); Status s = stream->Finish(); GPR_ASSERT(s.error_code() == StatusCode::CANCELLED); - gpr_log(GPR_INFO, "Canceling streaming done."); + gpr_log(GPR_DEBUG, "Canceling streaming done."); } void InteropClient::DoCancelAfterFirstResponse() { - gpr_log(GPR_INFO, "Sending Ping Pong streaming rpc ..."); + gpr_log(GPR_DEBUG, "Sending Ping Pong streaming rpc ..."); ClientContext context; std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, @@ -561,15 +563,16 @@ void InteropClient::DoCancelAfterFirstResponse() { GPR_ASSERT(stream->Write(request)); GPR_ASSERT(stream->Read(&response)); GPR_ASSERT(response.payload().body() == grpc::string(31415, '\0')); - gpr_log(GPR_INFO, "Trying to cancel..."); + gpr_log(GPR_DEBUG, "Trying to cancel..."); context.TryCancel(); Status s = stream->Finish(); - gpr_log(GPR_INFO, "Canceling pingpong streaming done."); + gpr_log(GPR_DEBUG, "Canceling pingpong streaming done."); } void InteropClient::DoTimeoutOnSleepingServer() { - gpr_log(GPR_INFO, "Sending Ping Pong streaming rpc with a short deadline..."); + gpr_log(GPR_DEBUG, + "Sending Ping Pong streaming rpc with a short deadline..."); ClientContext context; std::chrono::system_clock::time_point deadline = @@ -585,11 +588,11 @@ void InteropClient::DoTimeoutOnSleepingServer() { Status s = stream->Finish(); GPR_ASSERT(s.error_code() == StatusCode::DEADLINE_EXCEEDED); - gpr_log(GPR_INFO, "Pingpong streaming timeout done."); + gpr_log(GPR_DEBUG, "Pingpong streaming timeout done."); } void InteropClient::DoEmptyStream() { - gpr_log(GPR_INFO, "Starting empty_stream."); + gpr_log(GPR_DEBUG, "Starting empty_stream."); ClientContext context; std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, @@ -600,11 +603,12 @@ void InteropClient::DoEmptyStream() { GPR_ASSERT(stream->Read(&response) == false); Status s = stream->Finish(); AssertOkOrPrintErrorStatus(s); - gpr_log(GPR_INFO, "empty_stream done."); + gpr_log(GPR_DEBUG, "empty_stream done."); } void InteropClient::DoStatusWithMessage() { - gpr_log(GPR_INFO, "Sending RPC with a request for status code 2 and message"); + gpr_log(GPR_DEBUG, + "Sending RPC with a request for status code 2 and message"); ClientContext context; SimpleRequest request; @@ -618,7 +622,7 @@ void InteropClient::DoStatusWithMessage() { GPR_ASSERT(s.error_code() == grpc::StatusCode::UNKNOWN); GPR_ASSERT(s.error_message() == test_msg); - gpr_log(GPR_INFO, "Done testing Status and Message"); + gpr_log(GPR_DEBUG, "Done testing Status and Message"); } } // namespace testing diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 97a6fd77cf..3ecd380398 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -38,8 +38,8 @@ #include <grpc/grpc.h> #include <grpc++/channel.h> -#include "test/proto/messages.grpc.pb.h" -#include "test/proto/test.grpc.pb.h" +#include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index 2865c855a2..0c140ffd85 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -39,8 +39,8 @@ #include "test/cpp/util/metrics_server.h" #include "test/cpp/util/test_config.h" -#include "test/proto/metrics.grpc.pb.h" -#include "test/proto/metrics.pb.h" +#include "src/proto/grpc/testing/metrics.grpc.pb.h" +#include "src/proto/grpc/testing/metrics.pb.h" DEFINE_string(metrics_server_address, "", "The metrics server addresses in the fomrat <hostname>:<port>"); diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index d332dcad84..1f6b352db1 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -41,9 +41,9 @@ #include <grpc++/client_context.h> #include "test/cpp/util/create_test_channel.h" #include "test/cpp/util/test_config.h" -#include "test/proto/test.grpc.pb.h" -#include "test/proto/empty.grpc.pb.h" -#include "test/proto/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "src/proto/grpc/testing/empty.grpc.pb.h" +#include "src/proto/grpc/testing/messages.grpc.pb.h" DEFINE_int32(server_control_port, 0, "Server port for control rpcs."); DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection."); diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc index d08385a74c..3602b8c2b0 100644 --- a/test/cpp/interop/reconnect_interop_server.cc +++ b/test/cpp/interop/reconnect_interop_server.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,9 +48,9 @@ #include "test/core/util/reconnect_server.h" #include "test/cpp/util/test_config.h" -#include "test/proto/test.grpc.pb.h" -#include "test/proto/empty.grpc.pb.h" -#include "test/proto/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "src/proto/grpc/testing/empty.grpc.pb.h" +#include "src/proto/grpc/testing/messages.grpc.pb.h" DEFINE_int32(control_port, 0, "Server port for controlling the server."); DEFINE_int32(retry_port, 0, diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index c0e1ec943d..cdca060c23 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -50,9 +50,9 @@ #include "test/cpp/interop/server_helper.h" #include "test/cpp/util/test_config.h" -#include "test/proto/test.grpc.pb.h" -#include "test/proto/empty.grpc.pb.h" -#include "test/proto/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "src/proto/grpc/testing/empty.grpc.pb.h" +#include "src/proto/grpc/testing/messages.grpc.pb.h" DEFINE_bool(use_tls, false, "Whether to use tls."); DEFINE_int32(port, 0, "Server port."); diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc index 5d2951e3ed..b581e9b33c 100644 --- a/test/cpp/interop/stress_interop_client.cc +++ b/test/cpp/interop/stress_interop_client.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,7 +112,7 @@ void StressTestInteropClient::MainLoop(std::shared_ptr<Gauge> qps_gauge) { gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), test_end_time) < 0) { // Select the test case to execute based on the weights and execute it TestCaseType test_case = test_selector_.GetNextTest(); - gpr_log(GPR_INFO, "%d - Executing the test case %d", test_id_, test_case); + gpr_log(GPR_DEBUG, "%d - Executing the test case %d", test_id_, test_case); RunTest(test_case); num_calls_per_interval++; diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 934f4f5722..702354dc87 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,8 +47,12 @@ #include "test/cpp/interop/stress_interop_client.h" #include "test/cpp/util/metrics_server.h" #include "test/cpp/util/test_config.h" -#include "test/proto/metrics.grpc.pb.h" -#include "test/proto/metrics.pb.h" +#include "src/proto/grpc/testing/metrics.grpc.pb.h" +#include "src/proto/grpc/testing/metrics.pb.h" + +extern "C" { +extern void gpr_default_log(gpr_log_func_args* args); +} DEFINE_int32(metrics_port, 8081, "The metrics server port."); @@ -94,6 +98,12 @@ DEFINE_string(test_cases, "", " 'large_unary', 10% of the time and 'empty_stream' the remaining" " 70% of the time"); +DEFINE_int32(log_level, GPR_LOG_SEVERITY_DEBUG, + "Severity level of messages that should be logged. Any messages " + "greater than or equal to the level set here will be logged. " + "The choices are: 0 (GPR_LOG_SEVERITY_DEBUG), 1 " + "(GPR_LOG_SEVERITY_INFO) and 2 (GPR_LOG_SEVERITY_ERROR."); + using grpc::testing::kTestCaseList; using grpc::testing::MetricsService; using grpc::testing::MetricsServiceImpl; @@ -102,6 +112,16 @@ using grpc::testing::TestCaseType; using grpc::testing::UNKNOWN_TEST; using grpc::testing::WeightedRandomTestSelector; +static int log_level = GPR_LOG_SEVERITY_DEBUG; + +// A simple wrapper to grp_default_log() function. This only logs messages at or +// above the current log level (set in 'log_level' variable) +void TestLogFunction(gpr_log_func_args* args) { + if (args->severity >= log_level) { + gpr_default_log(args); + } +} + TestCaseType GetTestTypeFromName(const grpc::string& test_name) { TestCaseType test_case = UNKNOWN_TEST; @@ -190,6 +210,18 @@ void LogParameterInfo(const std::vector<grpc::string>& addresses, int main(int argc, char** argv) { grpc::testing::InitTest(&argc, &argv, true); + if (FLAGS_log_level > GPR_LOG_SEVERITY_ERROR || + FLAGS_log_level < GPR_LOG_SEVERITY_DEBUG) { + gpr_log(GPR_ERROR, "log_level should be an integer between %d and %d", + GPR_LOG_SEVERITY_DEBUG, GPR_LOG_SEVERITY_ERROR); + return 1; + } + + // Change the default log function to TestLogFunction which respects the + // log_level setting. + log_level = FLAGS_log_level; + gpr_set_log_function(TestLogFunction); + srand(time(NULL)); // Parse the server addresses @@ -198,7 +230,7 @@ int main(int argc, char** argv) { // Parse test cases and weights if (FLAGS_test_cases.length() == 0) { - gpr_log(GPR_INFO, "Not running tests. The 'test_cases' string is empty"); + gpr_log(GPR_ERROR, "Not running tests. The 'test_cases' string is empty"); return 1; } @@ -270,6 +302,5 @@ int main(int argc, char** argv) { it->join(); } - metrics_server->Wait(); return 0; } diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index b24a90adac..ee0049578d 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -41,8 +41,8 @@ #include "test/cpp/qps/interarrival.h" #include "test/cpp/qps/timer.h" #include "test/cpp/util/create_test_channel.h" -#include "test/proto/benchmarks/payloads.grpc.pb.h" -#include "test/proto/benchmarks/services.grpc.pb.h" +#include "src/proto/grpc/testing/payloads.grpc.pb.h" +#include "src/proto/grpc/testing/services.grpc.pb.h" namespace grpc { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 9594179822..3aaf06564c 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -51,7 +51,7 @@ #include "test/cpp/qps/timer.h" #include "test/cpp/qps/client.h" #include "test/cpp/util/create_test_channel.h" -#include "test/proto/benchmarks/services.grpc.pb.h" +#include "src/proto/grpc/testing/services.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 10d680860a..9e94f43e35 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -57,7 +57,7 @@ #include "test/cpp/qps/histogram.h" #include "test/cpp/qps/interarrival.h" #include "test/cpp/qps/timer.h" -#include "test/proto/benchmarks/services.grpc.pb.h" +#include "src/proto/grpc/testing/services.grpc.pb.h" #include "src/core/profiling/timers.h" diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 20dc65046b..acb265b308 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -48,7 +48,7 @@ #include "test/cpp/qps/driver.h" #include "test/cpp/qps/histogram.h" #include "test/cpp/qps/qps_worker.h" -#include "test/proto/benchmarks/services.grpc.pb.h" +#include "src/proto/grpc/testing/services.grpc.pb.h" using std::list; using std::thread; diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index 50bf17ceab..2a7cf805e5 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -37,7 +37,7 @@ #include <memory> #include "test/cpp/qps/histogram.h" -#include "test/proto/benchmarks/control.grpc.pb.h" +#include "src/proto/grpc/testing/control.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h index 4161eac826..acb415f0a1 100644 --- a/test/cpp/qps/histogram.h +++ b/test/cpp/qps/histogram.h @@ -35,7 +35,7 @@ #define TEST_QPS_HISTOGRAM_H #include <grpc/support/histogram.h> -#include "test/proto/benchmarks/stats.grpc.pb.h" +#include "src/proto/grpc/testing/stats.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/perf_db.proto b/test/cpp/qps/perf_db.proto deleted file mode 100644 index 8a691ddded..0000000000 --- a/test/cpp/qps/perf_db.proto +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -import "test/proto/benchmarks/control.proto"; - -package grpc.testing; - -service PerfDbTransfer { - // Sends client info - rpc RecordSingleClientData(SingleUserRecordRequest) - returns (SingleUserRecordReply) { - } -} - -// Metrics to be stored -message Metrics { - double qps = 1; - double qps_per_core = 2; - double perc_lat_50 = 3; - double perc_lat_90 = 4; - double perc_lat_95 = 5; - double perc_lat_99 = 6; - double perc_lat_99_point_9 = 7; - double server_system_time = 8; - double server_user_time = 9; - double client_system_time = 10; - double client_user_time = 11; -} - -// Request for storing a single user's data -message SingleUserRecordRequest { - string hashed_id = 1; - string test_name = 2; - string sys_info = 3; - string tag = 4; - Metrics metrics = 5; - ClientConfig client_config = 6; - ServerConfig server_config = 7; -} - -// Reply to request for storing single user's data -message SingleUserRecordReply { -} diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h index 72ebe79c3c..ece020aa9b 100644 --- a/test/cpp/qps/perf_db_client.h +++ b/test/cpp/qps/perf_db_client.h @@ -42,7 +42,7 @@ #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/security/credentials.h> -#include "test/cpp/qps/perf_db.grpc.pb.h" +#include "src/proto/grpc/testing/perf_db.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index dc59eab7ef..b3f383253f 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -55,7 +55,7 @@ #include "test/cpp/qps/client.h" #include "test/cpp/qps/server.h" #include "test/cpp/util/create_test_channel.h" -#include "test/proto/benchmarks/services.pb.h" +#include "src/proto/grpc/testing/services.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index 6e81edc8ff..620bc32f4b 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -40,8 +40,8 @@ #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/cpp/qps/timer.h" -#include "test/proto/messages.grpc.pb.h" -#include "test/proto/benchmarks/control.grpc.pb.h" +#include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/control.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 3fa8fc77f4..70fddbd9ef 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -50,7 +50,7 @@ #include <gtest/gtest.h> #include "test/cpp/qps/server.h" -#include "test/proto/benchmarks/services.grpc.pb.h" +#include "src/proto/grpc/testing/services.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 3a15bec888..97a1ff5255 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -45,7 +45,7 @@ #include "test/cpp/qps/server.h" #include "test/cpp/qps/timer.h" -#include "test/proto/benchmarks/services.grpc.pb.h" +#include "src/proto/grpc/testing/services.grpc.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 32cd8e4103..94f54616a9 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -44,16 +44,16 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "test/cpp/util/echo.grpc.pb.h" +#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; namespace grpc { namespace testing { -class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { +class TestServiceImpl : public ::grpc::testing::TestService::Service { public: Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) GRPC_OVERRIDE { @@ -91,11 +91,11 @@ class CliCallTest : public ::testing::Test { void ResetStub() { channel_ = CreateChannel(server_address_.str(), InsecureChannelCredentials()); - stub_ = grpc::cpp::test::util::TestService::NewStub(channel_); + stub_ = grpc::testing::TestService::NewStub(channel_); } std::shared_ptr<Channel> channel_; - std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; + std::unique_ptr<grpc::testing::TestService::Stub> stub_; std::unique_ptr<Server> server_; std::ostringstream server_address_; TestServiceImpl service_; @@ -115,7 +115,7 @@ TEST_F(CliCallTest, SimpleRpc) { EXPECT_EQ(response.message(), request.message()); EXPECT_TRUE(s.ok()); - const grpc::string kMethod("/grpc.cpp.test.util.TestService/Echo"); + const grpc::string kMethod("/grpc.testing.TestService/Echo"); grpc::string request_bin, response_bin, expected_response_bin; EXPECT_TRUE(request.SerializeToString(&request_bin)); EXPECT_TRUE(response.SerializeToString(&expected_response_bin)); diff --git a/test/cpp/util/echo.proto b/test/cpp/util/echo.proto deleted file mode 100644 index 8ea2f59897..0000000000 --- a/test/cpp/util/echo.proto +++ /dev/null @@ -1,47 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -import "test/cpp/util/messages.proto"; - -package grpc.cpp.test.util; - -service TestService { - rpc Echo(EchoRequest) returns (EchoResponse); - rpc RequestStream(stream EchoRequest) returns (EchoResponse); - rpc ResponseStream(EchoRequest) returns (stream EchoResponse); - rpc BidiStream(stream EchoRequest) returns (stream EchoResponse); - rpc Unimplemented(EchoRequest) returns (EchoResponse); -} - -service UnimplementedService { - rpc Unimplemented(EchoRequest) returns (EchoResponse); -} diff --git a/test/cpp/util/echo_duplicate.proto b/test/cpp/util/echo_duplicate.proto deleted file mode 100644 index 9c1d67825a..0000000000 --- a/test/cpp/util/echo_duplicate.proto +++ /dev/null @@ -1,42 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This is a partial copy of echo.proto with a different package name. - -syntax = "proto3"; - -import "test/cpp/util/messages.proto"; - -package grpc.cpp.test.util.duplicate; - -service TestService { - rpc Echo(grpc.cpp.test.util.EchoRequest) - returns (grpc.cpp.test.util.EchoResponse); -} diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 3f40b242fc..f9b9f0c40a 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -41,8 +41,9 @@ body: "hello world" } b. under grpc/ run - protoc --proto_path=test/proto/ \ - --encode=grpc.testing.SimpleRequest test/proto/messages.proto \ + protoc --proto_path=src/proto/grpc/testing/ \ + --encode=grpc.testing.SimpleRequest + src/proto/grpc/testing/messages.proto \ < input.txt > input.bin 2. Start a server make interop_server && bins/opt/interop_server --port=50051 @@ -51,8 +52,8 @@ /grpc.testing.TestService/UnaryCall --enable_ssl=false \ --input_binary_file=input.bin --output_binary_file=output.bin 4. Decode response - protoc --proto_path=test/proto/ \ - --decode=grpc.testing.SimpleResponse test/proto/messages.proto \ + protoc --proto_path=src/proto/grpc/testing/ \ + --decode=grpc.testing.SimpleResponse src/proto/grpc/testing/messages.proto \ < output.bin > output.txt 5. Now the text form of response should be in output.txt Optionally, metadata can be passed to server via flag --metadata, e.g. diff --git a/test/cpp/util/messages.proto b/test/cpp/util/messages.proto deleted file mode 100644 index a022707be9..0000000000 --- a/test/cpp/util/messages.proto +++ /dev/null @@ -1,60 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package grpc.cpp.test.util; - -message RequestParams { - bool echo_deadline = 1; - int32 client_cancel_after_us = 2; - int32 server_cancel_after_us = 3; - bool echo_metadata = 4; - bool check_auth_context = 5; - int32 response_message_length = 6; - bool echo_peer = 7; - string expected_client_identity = 8; // will force check_auth_context. -} - -message EchoRequest { - string message = 1; - RequestParams param = 2; -} - -message ResponseParams { - int64 request_deadline = 1; - string host = 2; - string peer = 3; -} - -message EchoResponse { - string message = 1; - ResponseParams param = 2; -} diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc index 426295f9b4..40028d3957 100644 --- a/test/cpp/util/metrics_server.cc +++ b/test/cpp/util/metrics_server.cc @@ -35,8 +35,8 @@ #include <grpc++/server_builder.h> -#include "test/proto/metrics.grpc.pb.h" -#include "test/proto/metrics.pb.h" +#include "src/proto/grpc/testing/metrics.grpc.pb.h" +#include "src/proto/grpc/testing/metrics.pb.h" namespace grpc { namespace testing { diff --git a/test/cpp/util/metrics_server.h b/test/cpp/util/metrics_server.h index edde37dc4c..ce05e0be64 100644 --- a/test/cpp/util/metrics_server.h +++ b/test/cpp/util/metrics_server.h @@ -36,11 +36,12 @@ #include <map> #include <mutex> -#include "test/proto/metrics.grpc.pb.h" -#include "test/proto/metrics.pb.h" +#include "src/proto/grpc/testing/metrics.grpc.pb.h" +#include "src/proto/grpc/testing/metrics.pb.h" /* - * This implements a Metrics server defined in test/proto/metrics.proto. Any + * This implements a Metrics server defined in + * src/proto/grpc/testing/metrics.proto. Any * test service can use this to export Metrics (TODO (sreek): Only Gauges for * now). * diff --git a/test/proto/benchmarks/control.proto b/test/proto/benchmarks/control.proto deleted file mode 100644 index 42a5dd0a85..0000000000 --- a/test/proto/benchmarks/control.proto +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -import "test/proto/benchmarks/payloads.proto"; -import "test/proto/benchmarks/stats.proto"; - -package grpc.testing; - -enum ClientType { - SYNC_CLIENT = 0; - ASYNC_CLIENT = 1; -} - -enum ServerType { - SYNC_SERVER = 0; - ASYNC_SERVER = 1; -} - -enum RpcType { - UNARY = 0; - STREAMING = 1; -} - -// Parameters of poisson process distribution, which is a good representation -// of activity coming in from independent identical stationary sources. -message PoissonParams { - // The rate of arrivals (a.k.a. lambda parameter of the exp distribution). - double offered_load = 1; -} - -message UniformParams { - double interarrival_lo = 1; - double interarrival_hi = 2; -} - -message DeterministicParams { - double offered_load = 1; -} - -message ParetoParams { - double interarrival_base = 1; - double alpha = 2; -} - -// Once an RPC finishes, immediately start a new one. -// No configuration parameters needed. -message ClosedLoopParams { -} - -message LoadParams { - oneof load { - ClosedLoopParams closed_loop = 1; - PoissonParams poisson = 2; - UniformParams uniform = 3; - DeterministicParams determ = 4; - ParetoParams pareto = 5; - }; -} - -// presence of SecurityParams implies use of TLS -message SecurityParams { - bool use_test_ca = 1; - string server_host_override = 2; -} - -message ClientConfig { - // List of targets to connect to. At least one target needs to be specified. - repeated string server_targets = 1; - ClientType client_type = 2; - SecurityParams security_params = 3; - // How many concurrent RPCs to start for each channel. - // For synchronous client, use a separate thread for each outstanding RPC. - int32 outstanding_rpcs_per_channel = 4; - // Number of independent client channels to create. - // i-th channel will connect to server_target[i % server_targets.size()] - int32 client_channels = 5; - // Only for async client. Number of threads to use to start/manage RPCs. - int32 async_client_threads = 7; - RpcType rpc_type = 8; - // The requested load for the entire client (aggregated over all the threads). - LoadParams load_params = 10; - PayloadConfig payload_config = 11; - HistogramParams histogram_params = 12; -} - -message ClientStatus { - ClientStats stats = 1; -} - -// Request current stats -message Mark { - // if true, the stats will be reset after taking their snapshot. - bool reset = 1; -} - -message ClientArgs { - oneof argtype { - ClientConfig setup = 1; - Mark mark = 2; - } -} - -message ServerConfig { - ServerType server_type = 1; - SecurityParams security_params = 2; - // Host on which to listen. - string host = 3; - // Port on which to listen. Zero means pick unused port. - int32 port = 4; - // Only for async server. Number of threads used to serve the requests. - int32 async_server_threads = 7; - // restrict core usage, currently unused - int32 core_limit = 8; - PayloadConfig payload_config = 9; -} - -message ServerArgs { - oneof argtype { - ServerConfig setup = 1; - Mark mark = 2; - } -} - -message ServerStatus { - ServerStats stats = 1; - // the port bound by the server - int32 port = 2; - // Number of cores on the server. See gpr_cpu_num_cores. - int32 cores = 3; -} diff --git a/test/proto/benchmarks/payloads.proto b/test/proto/benchmarks/payloads.proto deleted file mode 100644 index 7e5b2c61ff..0000000000 --- a/test/proto/benchmarks/payloads.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package grpc.testing; - -message ByteBufferParams { - int32 req_size = 1; - int32 resp_size = 2; -} - -message SimpleProtoParams { - int32 req_size = 1; - int32 resp_size = 2; -} - -message ComplexProtoParams { - // TODO (vpai): Fill this in once the details of complex, representative - // protos are decided -} - -message PayloadConfig { - oneof payload { - ByteBufferParams bytebuf_params = 1; - SimpleProtoParams simple_params = 2; - ComplexProtoParams complex_params = 3; - } -} diff --git a/test/proto/benchmarks/services.proto b/test/proto/benchmarks/services.proto deleted file mode 100644 index ff295ed970..0000000000 --- a/test/proto/benchmarks/services.proto +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. -syntax = "proto3"; - -import "test/proto/messages.proto"; -import "test/proto/benchmarks/control.proto"; - -package grpc.testing; - -service BenchmarkService { - // One request followed by one response. - // The server returns the client payload as-is. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by one response. - // The server returns the client payload as-is. - rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse); -} - -service WorkerService { - // Start server with specified workload. - // First request sent specifies the ServerConfig followed by ServerStatus - // response. After that, a "Mark" can be sent anytime to request the latest - // stats. Closing the stream will initiate shutdown of the test server - // and once the shutdown has finished, the OK status is sent to terminate - // this RPC. - rpc RunServer(stream ServerArgs) returns (stream ServerStatus); - - // Start client with specified workload. - // First request sent specifies the ClientConfig followed by ClientStatus - // response. After that, a "Mark" can be sent anytime to request the latest - // stats. Closing the stream will initiate shutdown of the test client - // and once the shutdown has finished, the OK status is sent to terminate - // this RPC. - rpc RunClient(stream ClientArgs) returns (stream ClientStatus); -} diff --git a/test/proto/benchmarks/stats.proto b/test/proto/benchmarks/stats.proto deleted file mode 100644 index 7e02707dbb..0000000000 --- a/test/proto/benchmarks/stats.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package grpc.testing; - -message ServerStats { - // wall clock time change in seconds since last reset - double time_elapsed = 1; - - // change in user time (in seconds) used by the server since last reset - double time_user = 2; - - // change in server time (in seconds) used by the server process and all - // threads since last reset - double time_system = 3; -} - -// Histogram params based on grpc/support/histogram.c -message HistogramParams { - double resolution = 1; // first bucket is [0, 1 + resolution) - double max_possible = 2; // use enough buckets to allow this value -} - -// Histogram data based on grpc/support/histogram.c -message HistogramData { - repeated uint32 bucket = 1; - double min_seen = 2; - double max_seen = 3; - double sum = 4; - double sum_of_squares = 5; - double count = 6; -} - -message ClientStats { - // Latency histogram. Data points are in nanoseconds. - HistogramData latencies = 1; - - // See ServerStats for details. - double time_elapsed = 2; - double time_user = 3; - double time_system = 4; -} diff --git a/test/proto/empty.proto b/test/proto/empty.proto deleted file mode 100644 index 6d0eb937d6..0000000000 --- a/test/proto/empty.proto +++ /dev/null @@ -1,43 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package grpc.testing; - -// An empty message that you can re-use to avoid defining duplicated empty -// messages in your project. A typical example is to use it as argument or the -// return value of a service API. For instance: -// -// service Foo { -// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; -// }; -// -message Empty {} diff --git a/test/proto/messages.proto b/test/proto/messages.proto deleted file mode 100644 index 193b6c4171..0000000000 --- a/test/proto/messages.proto +++ /dev/null @@ -1,167 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Message definitions to be used by integration test service definitions. - -syntax = "proto3"; - -package grpc.testing; - -// The type of payload that should be returned. -enum PayloadType { - // Compressable text format. - COMPRESSABLE = 0; - - // Uncompressable binary format. - UNCOMPRESSABLE = 1; - - // Randomly chosen from all other formats defined in this enum. - RANDOM = 2; -} - -// Compression algorithms -enum CompressionType { - // No compression - NONE = 0; - GZIP = 1; - DEFLATE = 2; -} - -// A block of data, to simply increase gRPC message size. -message Payload { - // The type of data in body. - PayloadType type = 1; - // Primary contents of payload. - bytes body = 2; -} - -// A protobuf representation for grpc status. This is used by test -// clients to specify a status that the server should attempt to return. -message EchoStatus { - int32 code = 1; - string message = 2; -} - -// Unary request. -message SimpleRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, server randomly chooses one from other formats. - PayloadType response_type = 1; - - // Desired payload size in the response from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 response_size = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; - - // Whether SimpleResponse should include username. - bool fill_username = 4; - - // Whether SimpleResponse should include OAuth scope. - bool fill_oauth_scope = 5; - - // Compression algorithm to be used by the server for the response (stream) - CompressionType response_compression = 6; - - // Whether server should return a given status - EchoStatus response_status = 7; -} - -// Unary response, as configured by the request. -message SimpleResponse { - // Payload to increase message size. - Payload payload = 1; - // The user the request came from, for verifying authentication was - // successful when the client expected it. - string username = 2; - // OAuth scope. - string oauth_scope = 3; -} - -// Client-streaming request. -message StreamingInputCallRequest { - // Optional input payload sent along with the request. - Payload payload = 1; - - // Not expecting any payload from the response. -} - -// Client-streaming response. -message StreamingInputCallResponse { - // Aggregated size of payloads received from the client. - int32 aggregated_payload_size = 1; -} - -// Configuration for a particular response. -message ResponseParameters { - // Desired payload sizes in responses from the server. - // If response_type is COMPRESSABLE, this denotes the size before compression. - int32 size = 1; - - // Desired interval between consecutive responses in the response stream in - // microseconds. - int32 interval_us = 2; -} - -// Server-streaming request. -message StreamingOutputCallRequest { - // Desired payload type in the response from the server. - // If response_type is RANDOM, the payload from each response in the stream - // might be of different types. This is to simulate a mixed type of payload - // stream. - PayloadType response_type = 1; - - // Configuration for each expected response message. - repeated ResponseParameters response_parameters = 2; - - // Optional input payload sent along with the request. - Payload payload = 3; - - // Compression algorithm to be used by the server for the response (stream) - CompressionType response_compression = 6; - - // Whether server should return a given status - EchoStatus response_status = 7; -} - -// Server-streaming response, as configured by the request and parameters. -message StreamingOutputCallResponse { - // Payload to increase response size. - Payload payload = 1; -} - -// For reconnect interop test only. -// Server tells client whether its reconnects are following the spec and the -// reconnect backoffs it saw. -message ReconnectInfo { - bool passed = 1; - repeated int32 backoff_ms = 2; -} diff --git a/test/proto/metrics.proto b/test/proto/metrics.proto deleted file mode 100644 index f5a08e056a..0000000000 --- a/test/proto/metrics.proto +++ /dev/null @@ -1,56 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. -syntax = "proto3"; - -package grpc.testing; - -message GaugeResponse { - string name = 1; - oneof value { - int64 long_value = 2; - double double_vale = 3; - string string_value = 4; - } -} - -message GaugeRequest { - string name = 1; -} - -message EmptyMessage { -} - -service MetricsService { - rpc GetAllGauges(EmptyMessage) returns (stream GaugeResponse); - rpc GetGauge(GaugeRequest) returns (GaugeResponse); -} diff --git a/test/proto/test.proto b/test/proto/test.proto deleted file mode 100644 index d3166a6540..0000000000 --- a/test/proto/test.proto +++ /dev/null @@ -1,86 +0,0 @@ - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// An integration test service that covers all the method signature permutations -// of unary/streaming requests/responses. - -syntax = "proto3"; - -import "test/proto/empty.proto"; -import "test/proto/messages.proto"; - -package grpc.testing; - -// A simple service to test the various types of RPCs and experiment with -// performance with various types of payload. -service TestService { - // One empty request followed by one empty response. - rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); - - // One request followed by one response. - rpc UnaryCall(SimpleRequest) returns (SimpleResponse); - - // One request followed by a sequence of responses (streamed download). - // The server returns the payload with client desired type and sizes. - rpc StreamingOutputCall(StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by one response (streamed upload). - // The server returns the aggregated size of client payload as the result. - rpc StreamingInputCall(stream StreamingInputCallRequest) - returns (StreamingInputCallResponse); - - // A sequence of requests with each request served by the server immediately. - // As one request could lead to multiple responses, this interface - // demonstrates the idea of full duplexing. - rpc FullDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); - - // A sequence of requests followed by a sequence of responses. - // The server buffers all the client requests and then serves them in order. A - // stream of responses are returned to the client when the server starts with - // first request. - rpc HalfDuplexCall(stream StreamingOutputCallRequest) - returns (stream StreamingOutputCallResponse); -} - - -// A simple service NOT implemented at servers so clients can test for -// that case. -service UnimplementedService { - // A call that no server should implement - rpc UnimplementedCall(grpc.testing.Empty) returns(grpc.testing.Empty); -} - -// A service used to control reconnect server. -service ReconnectService { - rpc Start(grpc.testing.Empty) returns (grpc.testing.Empty); - rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo); -} |