grpc 1.60.0.pre1-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/etc/roots.pem +4337 -0
- data/grpc_c.32-msvcrt.ruby +0 -0
- data/grpc_c.64-msvcrt.ruby +0 -0
- data/grpc_c.64-ucrt.ruby +0 -0
- data/src/ruby/bin/math_client.rb +140 -0
- data/src/ruby/bin/math_pb.rb +40 -0
- data/src/ruby/bin/math_server.rb +191 -0
- data/src/ruby/bin/math_services_pb.rb +51 -0
- data/src/ruby/bin/noproto_client.rb +93 -0
- data/src/ruby/bin/noproto_server.rb +97 -0
- data/src/ruby/ext/grpc/ext-export-truffleruby-with-ruby-abi-version.clang +2 -0
- data/src/ruby/ext/grpc/ext-export-truffleruby-with-ruby-abi-version.gcc +7 -0
- data/src/ruby/ext/grpc/ext-export-with-ruby-abi-version.clang +2 -0
- data/src/ruby/ext/grpc/ext-export-with-ruby-abi-version.gcc +7 -0
- data/src/ruby/ext/grpc/ext-export.clang +1 -0
- data/src/ruby/ext/grpc/ext-export.gcc +6 -0
- data/src/ruby/ext/grpc/extconf.rb +270 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.c +65 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.h +35 -0
- data/src/ruby/ext/grpc/rb_call.c +1075 -0
- data/src/ruby/ext/grpc/rb_call.h +57 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +340 -0
- data/src/ruby/ext/grpc/rb_call_credentials.h +31 -0
- data/src/ruby/ext/grpc/rb_channel.c +875 -0
- data/src/ruby/ext/grpc/rb_channel.h +35 -0
- data/src/ruby/ext/grpc/rb_channel_args.c +172 -0
- data/src/ruby/ext/grpc/rb_channel_args.h +42 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +285 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.h +37 -0
- data/src/ruby/ext/grpc/rb_completion_queue.c +101 -0
- data/src/ruby/ext/grpc/rb_completion_queue.h +36 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +470 -0
- data/src/ruby/ext/grpc/rb_compression_options.h +29 -0
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
- data/src/ruby/ext/grpc/rb_event_thread.c +161 -0
- data/src/ruby/ext/grpc/rb_event_thread.h +22 -0
- data/src/ruby/ext/grpc/rb_grpc.c +496 -0
- data/src/ruby/ext/grpc/rb_grpc.h +83 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +603 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +910 -0
- data/src/ruby/ext/grpc/rb_loader.c +61 -0
- data/src/ruby/ext/grpc/rb_loader.h +25 -0
- data/src/ruby/ext/grpc/rb_server.c +405 -0
- data/src/ruby/ext/grpc/rb_server.h +32 -0
- data/src/ruby/ext/grpc/rb_server_credentials.c +258 -0
- data/src/ruby/ext/grpc/rb_server_credentials.h +37 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +217 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +37 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +37 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.2/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
- data/src/ruby/lib/grpc/core/time_consts.rb +56 -0
- data/src/ruby/lib/grpc/errors.rb +277 -0
- data/src/ruby/lib/grpc/generic/active_call.rb +670 -0
- data/src/ruby/lib/grpc/generic/bidi_call.rb +237 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +503 -0
- data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
- data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +204 -0
- data/src/ruby/lib/grpc/generic/rpc_server.rb +551 -0
- data/src/ruby/lib/grpc/generic/service.rb +211 -0
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +40 -0
- data/src/ruby/lib/grpc/grpc.rb +24 -0
- data/src/ruby/lib/grpc/logconfig.rb +44 -0
- data/src/ruby/lib/grpc/notifier.rb +45 -0
- data/src/ruby/lib/grpc/structs.rb +15 -0
- data/src/ruby/lib/grpc/version.rb +18 -0
- data/src/ruby/lib/grpc.rb +37 -0
- data/src/ruby/pb/README.md +42 -0
- data/src/ruby/pb/generate_proto_ruby.sh +46 -0
- data/src/ruby/pb/grpc/health/checker.rb +75 -0
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +42 -0
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +62 -0
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +44 -0
- data/src/ruby/pb/grpc/testing/metrics_pb.rb +28 -0
- data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +49 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +38 -0
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +71 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +40 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +174 -0
- data/src/ruby/pb/test/client.rb +785 -0
- data/src/ruby/pb/test/server.rb +252 -0
- data/src/ruby/pb/test/xds_client.rb +415 -0
- data/src/ruby/spec/call_credentials_spec.rb +42 -0
- data/src/ruby/spec/call_spec.rb +180 -0
- data/src/ruby/spec/channel_connection_spec.rb +126 -0
- data/src/ruby/spec/channel_credentials_spec.rb +124 -0
- data/src/ruby/spec/channel_spec.rb +207 -0
- data/src/ruby/spec/client_auth_spec.rb +152 -0
- data/src/ruby/spec/client_server_spec.rb +676 -0
- data/src/ruby/spec/compression_options_spec.rb +149 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/error_sanity_spec.rb +49 -0
- data/src/ruby/spec/errors_spec.rb +142 -0
- data/src/ruby/spec/generic/active_call_spec.rb +692 -0
- data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
- data/src/ruby/spec/generic/client_stub_spec.rb +1083 -0
- data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
- data/src/ruby/spec/generic/rpc_desc_spec.rb +374 -0
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +127 -0
- data/src/ruby/spec/generic/rpc_server_spec.rb +748 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
- data/src/ruby/spec/generic/service_spec.rb +263 -0
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +282 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options.proto +28 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +41 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +98 -0
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +57 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +236 -0
- data/src/ruby/spec/server_credentials_spec.rb +104 -0
- data/src/ruby/spec/server_spec.rb +231 -0
- data/src/ruby/spec/spec_helper.rb +61 -0
- data/src/ruby/spec/support/helpers.rb +107 -0
- data/src/ruby/spec/support/services.rb +160 -0
- data/src/ruby/spec/testdata/README +1 -0
- data/src/ruby/spec/testdata/ca.pem +20 -0
- data/src/ruby/spec/testdata/client.key +28 -0
- data/src/ruby/spec/testdata/client.pem +20 -0
- data/src/ruby/spec/testdata/server1.key +28 -0
- data/src/ruby/spec/testdata/server1.pem +22 -0
- data/src/ruby/spec/time_consts_spec.rb +74 -0
- data/src/ruby/spec/user_agent_spec.rb +74 -0
- metadata +405 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
# Copyright 2017 gRPC authors.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
require 'spec_helper'
|
15
|
+
|
16
|
+
describe 'Client Interceptors' do
|
17
|
+
let(:interceptor) { TestClientInterceptor.new }
|
18
|
+
let(:interceptors_opts) { { interceptors: [interceptor] } }
|
19
|
+
let(:request) { EchoMsg.new }
|
20
|
+
let(:service) { EchoService }
|
21
|
+
|
22
|
+
before(:each) do
|
23
|
+
build_rpc_server
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when a client interceptor is added' do
|
27
|
+
context 'with a request/response call' do
|
28
|
+
it 'should be called', server: true do
|
29
|
+
expect(interceptor).to receive(:request_response)
|
30
|
+
.once.and_call_original
|
31
|
+
|
32
|
+
run_services_on_server(@server, services: [service]) do
|
33
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
34
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:request_response)
|
35
|
+
.once.and_call_original
|
36
|
+
expect(stub.an_rpc(request)).to be_a(EchoMsg)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'can modify outgoing metadata', server: true do
|
41
|
+
expect(interceptor).to receive(:request_response)
|
42
|
+
.once.and_call_original
|
43
|
+
|
44
|
+
run_services_on_server(@server, services: [service]) do
|
45
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
46
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:request_response)
|
47
|
+
.with(request, metadata: { 'foo' => 'bar_from_request_response' })
|
48
|
+
.once.and_call_original
|
49
|
+
expect(stub.an_rpc(request)).to be_a(EchoMsg)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'with a client streaming call' do
|
55
|
+
it 'should be called', server: true do
|
56
|
+
expect(interceptor).to receive(:client_streamer)
|
57
|
+
.once.and_call_original
|
58
|
+
|
59
|
+
run_services_on_server(@server, services: [service]) do
|
60
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
61
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:client_streamer)
|
62
|
+
.once.and_call_original
|
63
|
+
requests = [EchoMsg.new, EchoMsg.new]
|
64
|
+
expect(stub.a_client_streaming_rpc(requests)).to be_a(EchoMsg)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'can modify outgoing metadata', server: true do
|
69
|
+
expect(interceptor).to receive(:client_streamer)
|
70
|
+
.once.and_call_original
|
71
|
+
|
72
|
+
run_services_on_server(@server, services: [service]) do
|
73
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
74
|
+
requests = [EchoMsg.new, EchoMsg.new]
|
75
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:client_streamer)
|
76
|
+
.with(requests, metadata: { 'foo' => 'bar_from_client_streamer' })
|
77
|
+
.once.and_call_original
|
78
|
+
expect(stub.a_client_streaming_rpc(requests)).to be_a(EchoMsg)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'with a server streaming call' do
|
84
|
+
it 'should be called', server: true do
|
85
|
+
expect(interceptor).to receive(:server_streamer)
|
86
|
+
.once.and_call_original
|
87
|
+
|
88
|
+
run_services_on_server(@server, services: [service]) do
|
89
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
90
|
+
request = EchoMsg.new
|
91
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:server_streamer)
|
92
|
+
.once.and_call_original
|
93
|
+
responses = stub.a_server_streaming_rpc(request)
|
94
|
+
responses.each do |r|
|
95
|
+
expect(r).to be_a(EchoMsg)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'can modify outgoing metadata', server: true do
|
101
|
+
expect(interceptor).to receive(:server_streamer)
|
102
|
+
.once.and_call_original
|
103
|
+
|
104
|
+
run_services_on_server(@server, services: [service]) do
|
105
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
106
|
+
request = EchoMsg.new
|
107
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:server_streamer)
|
108
|
+
.with(request, metadata: { 'foo' => 'bar_from_server_streamer' })
|
109
|
+
.once.and_call_original
|
110
|
+
responses = stub.a_server_streaming_rpc(request)
|
111
|
+
responses.each do |r|
|
112
|
+
expect(r).to be_a(EchoMsg)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'with a bidi call' do
|
119
|
+
it 'should be called', server: true do
|
120
|
+
expect(interceptor).to receive(:bidi_streamer)
|
121
|
+
.once.and_call_original
|
122
|
+
|
123
|
+
run_services_on_server(@server, services: [service]) do
|
124
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
125
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:bidi_streamer)
|
126
|
+
.once.and_call_original
|
127
|
+
requests = [EchoMsg.new, EchoMsg.new]
|
128
|
+
responses = stub.a_bidi_rpc(requests)
|
129
|
+
responses.each do |r|
|
130
|
+
expect(r).to be_a(EchoMsg)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'can modify outgoing metadata', server: true do
|
136
|
+
expect(interceptor).to receive(:bidi_streamer)
|
137
|
+
.once.and_call_original
|
138
|
+
|
139
|
+
run_services_on_server(@server, services: [service]) do
|
140
|
+
stub = build_insecure_stub(EchoStub, opts: interceptors_opts)
|
141
|
+
requests = [EchoMsg.new, EchoMsg.new]
|
142
|
+
expect_any_instance_of(GRPC::ActiveCall).to receive(:bidi_streamer)
|
143
|
+
.with(requests, metadata: { 'foo' => 'bar_from_bidi_streamer' })
|
144
|
+
.once.and_call_original
|
145
|
+
responses = stub.a_bidi_rpc(requests)
|
146
|
+
responses.each do |r|
|
147
|
+
expect(r).to be_a(EchoMsg)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|