diff options
author | Mark D. Roth <roth@google.com> | 2017-01-10 11:02:18 -0800 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2017-01-10 11:02:18 -0800 |
commit | d54c906ba413c6b9eccf8093ed161e7a187d0296 (patch) | |
tree | 631838f8dae5a0d7b33d274143cc3ec41c75f16f | |
parent | 466589606a933bfcc453c51daef8fc7f689001e0 (diff) | |
parent | a3960b98d6a1b85a1e3b89cd7797a509505fa207 (diff) |
Merge remote-tracking branch 'upstream/master' into http_connect_headers
-rw-r--r-- | src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb | 7 | ||||
-rwxr-xr-x | src/ruby/pb/test/client.rb | 171 | ||||
-rw-r--r-- | tools/doxygen/Doxyfile.c++ | 42 | ||||
-rw-r--r-- | tools/doxygen/Doxyfile.c++.internal | 40 | ||||
-rw-r--r-- | tools/doxygen/Doxyfile.core | 38 | ||||
-rw-r--r-- | tools/doxygen/Doxyfile.core.internal | 62 |
6 files changed, 263 insertions, 97 deletions
diff --git a/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb b/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb index fde328e4c5..7d1072e512 100644 --- a/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +++ b/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb @@ -54,6 +54,10 @@ module Grpc rpc :EmptyCall, Empty, Empty # One request followed by one response. rpc :UnaryCall, SimpleRequest, SimpleResponse + # One request followed by one response. Response has cache control + # headers set such that a caching HTTP proxy (such as GFE) can + # satisfy subsequent requests. + rpc :CacheableUnaryCall, SimpleRequest, 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, stream(StreamingOutputCallResponse) @@ -69,6 +73,9 @@ module Grpc # stream of responses are returned to the client when the server starts with # first request. rpc :HalfDuplexCall, stream(StreamingOutputCallRequest), stream(StreamingOutputCallResponse) + # The test server will not implement this method. It will be used + # to test the behavior when clients call unimplemented methods. + rpc :UnimplementedCall, Empty, Empty end Stub = Service.rpc_stub_class diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb index f101f9d89e..e051676463 100755 --- a/src/ruby/pb/test/client.rb +++ b/src/ruby/pb/test/client.rb @@ -158,14 +158,26 @@ def create_stub(opts) GRPC.logger.info("... connecting securely to #{address}") stub_opts[:channel_args].merge!(compression_channel_args) - Grpc::Testing::TestService::Stub.new(address, creds, **stub_opts) + if opts.test_case == "unimplemented_service" + Grpc::Testing::UnimplementedService::Stub.new(address, creds, **stub_opts) + else + Grpc::Testing::TestService::Stub.new(address, creds, **stub_opts) + end else GRPC.logger.info("... connecting insecurely to #{address}") - Grpc::Testing::TestService::Stub.new( - address, - :this_channel_is_insecure, - channel_args: compression_channel_args - ) + if opts.test_case == "unimplemented_service" + Grpc::Testing::UnimplementedService::Stub.new( + address, + :this_channel_is_insecure, + channel_args: compression_channel_args + ) + else + Grpc::Testing::TestService::Stub.new( + address, + :this_channel_is_insecure, + channel_args: compression_channel_args + ) + end end end @@ -502,6 +514,153 @@ class NamedTests op.wait end + def unimplemented_method + begin + resp = @stub.unimplemented_call(Empty.new) + rescue GRPC::Unimplemented => e + return + rescue Exception => e + fail AssertionError, "Expected BadStatus. Received: #{e.inspect}" + end + fail AssertionError, "GRPC::Unimplemented should have been raised. Was not." + end + + def unimplemented_service + begin + resp = @stub.unimplemented_call(Empty.new) + rescue GRPC::Unimplemented => e + return + rescue Exception => e + fail AssertionError, "Expected BadStatus. Received: #{e.inspect}" + end + fail AssertionError, "GRPC::Unimplemented should have been raised. Was not." + end + + def status_code_and_message + + # Function wide constants. + message = "test status method" + code = GRPC::Core::StatusCodes::UNKNOWN + + # Testing with UnaryCall. + payload = Payload.new(type: :COMPRESSABLE, body: nulls(1)) + echo_status = EchoStatus.new(code: code, message: message) + req = SimpleRequest.new(response_type: :COMPRESSABLE, + response_size: 1, + payload: payload, + response_status: echo_status) + seen_correct_exception = false + begin + resp = @stub.unary_call(req) + rescue GRPC::Unknown => e + if e.details != message + fail AssertionError, + "Expected message #{message}. Received: #{e.details}" + end + seen_correct_exception = true + rescue Exception => e + fail AssertionError, "Expected BadStatus. Received: #{e.inspect}" + end + + if not seen_correct_exception + fail AssertionError, "Did not see expected status from UnaryCall" + end + + # testing with FullDuplex + req_cls, p_cls = StreamingOutputCallRequest, ResponseParameters + duplex_req = req_cls.new(payload: Payload.new(body: nulls(1)), + response_type: :COMPRESSABLE, + response_parameters: [p_cls.new(size: 1)], + response_status: echo_status) + seen_correct_exception = false + begin + resp = @stub.full_duplex_call([duplex_req]) + resp.next # triggers initial req to be sent + rescue GRPC::Unknown => e + if e.details != message + fail AssertionError, + "Expected message #{message}. Received: #{e.details}" + end + seen_correct_exception = true + rescue Exception => e + fail AssertionError, "Expected BadStatus. Received: #{e.inspect}" + end + + if not seen_correct_exception + fail AssertionError, "Did not see expected status from FullDuplexCall" + end + + end + + + def custom_metadata + + # Function wide constants + req_size, wanted_response_size = 271_828, 314_159 + initial_metadata_key = "x-grpc-test-echo-initial" + initial_metadata_value = "test_initial_metadata_value" + trailing_metadata_key = "x-grpc-test-echo-trailing-bin" + trailing_metadata_value = "\x0a\x0b\x0a\x0b\x0a\x0b" + + metadata = { + initial_metadata_key => initial_metadata_value, + trailing_metadata_key => trailing_metadata_value + } + + # Testing with UnaryCall + payload = Payload.new(type: :COMPRESSABLE, body: nulls(req_size)) + req = SimpleRequest.new(response_type: :COMPRESSABLE, + response_size: wanted_response_size, + payload: payload) + + op = @stub.unary_call(req, metadata: metadata, return_op: true) + op.execute + if not op.metadata.has_key?(initial_metadata_key) + fail AssertionError, "Expected initial metadata. None received" + elsif op.metadata[initial_metadata_key] != metadata[initial_metadata_key] + fail AssertionError, + "Expected initial metadata: #{metadata[initial_metadata_key]}. "\ + "Received: #{op.metadata[initial_metadata_key]}" + end + if not op.trailing_metadata.has_key?(trailing_metadata_key) + fail AssertionError, "Expected trailing metadata. None received" + elsif op.trailing_metadata[trailing_metadata_key] != + metadata[trailing_metadata_key] + fail AssertionError, + "Expected trailing metadata: #{metadata[trailing_metadata_key]}. "\ + "Received: #{op.trailing_metadata[trailing_metadata_key]}" + end + + # Testing with FullDuplex + req_cls, p_cls = StreamingOutputCallRequest, ResponseParameters + duplex_req = req_cls.new(payload: Payload.new(body: nulls(req_size)), + response_type: :COMPRESSABLE, + response_parameters: [p_cls.new(size: wanted_response_size)]) + + duplex_op = @stub.full_duplex_call([duplex_req], metadata: metadata, + return_op: true) + resp = duplex_op.execute + resp.each { |r| } # ensures that the server sends trailing data + duplex_op.wait + if not duplex_op.metadata.has_key?(initial_metadata_key) + fail AssertionError, "Expected initial metadata. None received" + elsif duplex_op.metadata[initial_metadata_key] != + metadata[initial_metadata_key] + fail AssertionError, + "Expected initial metadata: #{metadata[initial_metadata_key]}. "\ + "Received: #{duplex_op.metadata[initial_metadata_key]}" + end + if not duplex_op.trailing_metadata[trailing_metadata_key] + fail AssertionError, "Expected trailing metadata. None received" + elsif duplex_op.trailing_metadata[trailing_metadata_key] != + metadata[trailing_metadata_key] + fail AssertionError, + "Expected trailing metadata: #{metadata[trailing_metadata_key]}. "\ + "Received: #{duplex_op.trailing_metadata[trailing_metadata_key]}" + end + + end + def all all_methods = NamedTests.instance_methods(false).map(&:to_s) all_methods.each do |m| diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 2c16f6f24a..6539f96565 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -848,34 +848,34 @@ include/grpc/impl/codegen/sync.h \ include/grpc/impl/codegen/sync_generic.h \ include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_windows.h \ -doc/fail_fast.md \ -doc/compression.md \ -doc/environment_variables.md \ -doc/stress_test_framework.md \ -doc/PROTOCOL-WEB.md \ -doc/cpp-style-guide.md \ -doc/http-grpc-status-mapping.md \ -doc/wait-for-ready.md \ -doc/command_line_tool.md \ +doc/binary-logging.md \ doc/c-style-guide.md \ -doc/server_reflection_tutorial.md \ -doc/health-checking.md \ +doc/command_line_tool.md \ +doc/compression.md \ +doc/compression_cookbook.md \ doc/connection-backoff-interop-test-description.md \ -doc/epoll-polling-engine.md \ -doc/naming.md \ -doc/binary-logging.md \ -doc/connectivity-semantics-and-api.md \ doc/connection-backoff.md \ -doc/compression_cookbook.md \ -doc/PROTOCOL-HTTP2.md \ +doc/connectivity-semantics-and-api.md \ +doc/cpp-style-guide.md \ +doc/environment_variables.md \ +doc/epoll-polling-engine.md \ +doc/fail_fast.md \ +doc/g_stands_for.md \ +doc/health-checking.md \ +doc/http-grpc-status-mapping.md \ +doc/interop-test-descriptions.md \ doc/load-balancing.md \ +doc/naming.md \ doc/negative-http2-interop-test-descriptions.md \ +doc/PROTOCOL-HTTP2.md \ +doc/PROTOCOL-WEB.md \ doc/server-reflection.md \ -doc/interop-test-descriptions.md \ +doc/server_reflection_tutorial.md \ doc/statuscodes.md \ -doc/g_stands_for.md \ -doc/cpp/perf_notes.md \ -doc/cpp/pending_api_cleanups.md +doc/stress_test_framework.md \ +doc/wait-for-ready.md \ +doc/cpp/pending_api_cleanups.md \ +doc/cpp/perf_notes.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 89915d7b08..ffef534fe2 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -894,34 +894,34 @@ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ src/cpp/codegen/codegen_init.cc \ -doc/fail_fast.md \ -doc/compression.md \ -doc/environment_variables.md \ -doc/stress_test_framework.md \ -doc/PROTOCOL-WEB.md \ -doc/cpp-style-guide.md \ -doc/http-grpc-status-mapping.md \ -doc/wait-for-ready.md \ -doc/command_line_tool.md \ +doc/binary-logging.md \ doc/c-style-guide.md \ -doc/server_reflection_tutorial.md \ -doc/health-checking.md \ +doc/command_line_tool.md \ +doc/compression.md \ +doc/compression_cookbook.md \ doc/connection-backoff-interop-test-description.md \ -doc/epoll-polling-engine.md \ -doc/naming.md \ -doc/binary-logging.md \ -doc/connectivity-semantics-and-api.md \ doc/connection-backoff.md \ -doc/compression_cookbook.md \ -doc/PROTOCOL-HTTP2.md \ +doc/connectivity-semantics-and-api.md \ +doc/cpp-style-guide.md \ +doc/environment_variables.md \ +doc/epoll-polling-engine.md \ +doc/fail_fast.md \ +doc/g_stands_for.md \ +doc/health-checking.md \ +doc/http-grpc-status-mapping.md \ +doc/interop-test-descriptions.md \ doc/load-balancing.md \ +doc/naming.md \ doc/negative-http2-interop-test-descriptions.md \ +doc/PROTOCOL-HTTP2.md \ +doc/PROTOCOL-WEB.md \ doc/server-reflection.md \ -doc/interop-test-descriptions.md \ +doc/server_reflection_tutorial.md \ doc/statuscodes.md \ -doc/g_stands_for.md \ -doc/cpp/perf_notes.md \ +doc/stress_test_framework.md \ +doc/wait-for-ready.md \ doc/cpp/pending_api_cleanups.md \ +doc/cpp/perf_notes.md \ src/cpp/README.md # This tag can be used to specify the character encoding of the source files diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index e7fc1dbc57..f8a3970416 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -826,32 +826,32 @@ include/grpc/impl/codegen/sync.h \ include/grpc/impl/codegen/sync_generic.h \ include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_windows.h \ -doc/fail_fast.md \ -doc/compression.md \ -doc/environment_variables.md \ -doc/stress_test_framework.md \ -doc/PROTOCOL-WEB.md \ -doc/cpp-style-guide.md \ -doc/http-grpc-status-mapping.md \ -doc/wait-for-ready.md \ -doc/command_line_tool.md \ +doc/binary-logging.md \ doc/c-style-guide.md \ -doc/server_reflection_tutorial.md \ -doc/health-checking.md \ +doc/command_line_tool.md \ +doc/compression.md \ +doc/compression_cookbook.md \ doc/connection-backoff-interop-test-description.md \ -doc/epoll-polling-engine.md \ -doc/naming.md \ -doc/binary-logging.md \ -doc/connectivity-semantics-and-api.md \ doc/connection-backoff.md \ -doc/compression_cookbook.md \ -doc/PROTOCOL-HTTP2.md \ +doc/connectivity-semantics-and-api.md \ +doc/cpp-style-guide.md \ +doc/environment_variables.md \ +doc/epoll-polling-engine.md \ +doc/fail_fast.md \ +doc/g_stands_for.md \ +doc/health-checking.md \ +doc/http-grpc-status-mapping.md \ +doc/interop-test-descriptions.md \ doc/load-balancing.md \ +doc/naming.md \ doc/negative-http2-interop-test-descriptions.md \ +doc/PROTOCOL-HTTP2.md \ +doc/PROTOCOL-WEB.md \ doc/server-reflection.md \ -doc/interop-test-descriptions.md \ +doc/server_reflection_tutorial.md \ doc/statuscodes.md \ -doc/g_stands_for.md \ +doc/stress_test_framework.md \ +doc/wait-for-ready.md \ doc/core/pending_api_cleanups.md # This tag can be used to specify the character encoding of the source files diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8b60152009..1a945bec49 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1281,54 +1281,54 @@ src/core/lib/support/tmpfile_msys.c \ src/core/lib/support/tmpfile_posix.c \ src/core/lib/support/tmpfile_windows.c \ src/core/lib/support/wrap_memcpy.c \ -doc/fail_fast.md \ -doc/compression.md \ -doc/environment_variables.md \ -doc/stress_test_framework.md \ -doc/PROTOCOL-WEB.md \ -doc/cpp-style-guide.md \ -doc/http-grpc-status-mapping.md \ -doc/wait-for-ready.md \ -doc/command_line_tool.md \ +doc/binary-logging.md \ doc/c-style-guide.md \ -doc/server_reflection_tutorial.md \ -doc/health-checking.md \ +doc/command_line_tool.md \ +doc/compression.md \ +doc/compression_cookbook.md \ doc/connection-backoff-interop-test-description.md \ -doc/epoll-polling-engine.md \ -doc/naming.md \ -doc/binary-logging.md \ -doc/connectivity-semantics-and-api.md \ doc/connection-backoff.md \ -doc/compression_cookbook.md \ -doc/PROTOCOL-HTTP2.md \ +doc/connectivity-semantics-and-api.md \ +doc/cpp-style-guide.md \ +doc/environment_variables.md \ +doc/epoll-polling-engine.md \ +doc/fail_fast.md \ +doc/g_stands_for.md \ +doc/health-checking.md \ +doc/http-grpc-status-mapping.md \ +doc/interop-test-descriptions.md \ doc/load-balancing.md \ +doc/naming.md \ doc/negative-http2-interop-test-descriptions.md \ +doc/PROTOCOL-HTTP2.md \ +doc/PROTOCOL-WEB.md \ doc/server-reflection.md \ -doc/interop-test-descriptions.md \ +doc/server_reflection_tutorial.md \ doc/statuscodes.md \ -doc/g_stands_for.md \ +doc/stress_test_framework.md \ +doc/wait-for-ready.md \ doc/core/pending_api_cleanups.md \ src/core/README.md \ src/core/ext/README.md \ +src/core/ext/census/README.md \ +src/core/ext/census/gen/README.md \ +src/core/ext/client_channel/README.md \ +src/core/ext/resolver/README.md \ +src/core/ext/resolver/dns/native/README.md \ +src/core/ext/resolver/sockaddr/README.md \ src/core/ext/transport/README.md \ src/core/ext/transport/chttp2/README.md \ -src/core/ext/transport/chttp2/client/secure/README.md \ src/core/ext/transport/chttp2/client/insecure/README.md \ -src/core/ext/transport/chttp2/transport/README.md \ -src/core/ext/transport/chttp2/server/secure/README.md \ +src/core/ext/transport/chttp2/client/secure/README.md \ src/core/ext/transport/chttp2/server/insecure/README.md \ -src/core/ext/client_channel/README.md \ -src/core/ext/resolver/README.md \ -src/core/ext/resolver/sockaddr/README.md \ -src/core/ext/resolver/dns/native/README.md \ -src/core/ext/census/README.md \ -src/core/ext/census/gen/README.md \ +src/core/ext/transport/chttp2/server/secure/README.md \ +src/core/ext/transport/chttp2/transport/README.md \ src/core/lib/README.md \ -src/core/lib/tsi/README.md \ src/core/lib/channel/README.md \ -src/core/lib/transport/README.md \ src/core/lib/iomgr/README.md \ -src/core/lib/surface/README.md +src/core/lib/surface/README.md \ +src/core/lib/transport/README.md \ +src/core/lib/tsi/README.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses |