grpc 1.6.2-x86-linux → 1.6.4-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/grpc_c.32.ruby +0 -0
- data/grpc_c.64.ruby +0 -0
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +9 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +73 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d568d3b53150fd9a1e92b2e75e6957b5701b4e20
|
4
|
+
data.tar.gz: 1d003dc5bcf2e3952280ea59a8d371e086e20fab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a72806bc9d1922e9df1396e56ed7f672d8e40d3f10d405133559a94c793a5dc0d693d7603f3e6a959fe531f8c2b7e0f08bc6bddb899ae0a4f515b8d16f1cc194
|
7
|
+
data.tar.gz: cce4ee4f1173221b61af2be4b8ad2021d6832038cb78a920f00c0bad2d6f2fa7bfd8b203eae2c2c930a4052ee48517ebd926858efab118b5dc708753377e87f9
|
data/grpc_c.32.ruby
CHANGED
Binary file
|
data/grpc_c.64.ruby
CHANGED
Binary file
|
@@ -19,10 +19,18 @@ require 'google/rpc/status_pb'
|
|
19
19
|
module GRPC
|
20
20
|
# GoogleRpcStatusUtils provides utilities to convert between a
|
21
21
|
# GRPC::Core::Status and a deserialized Google::Rpc::Status proto
|
22
|
+
# Returns nil if the grpc-status-details-bin trailer could not be
|
23
|
+
# converted to a GoogleRpcStatus due to the server not providing
|
24
|
+
# the necessary trailers.
|
25
|
+
# Raises an error if the server did provide the necessary trailers
|
26
|
+
# but they fail to deseriliaze into a GoogleRpcStatus protobuf.
|
22
27
|
class GoogleRpcStatusUtils
|
23
28
|
def self.extract_google_rpc_status(status)
|
24
29
|
fail ArgumentError, 'bad type' unless status.is_a? Struct::Status
|
25
|
-
|
30
|
+
grpc_status_details_bin_trailer = 'grpc-status-details-bin'
|
31
|
+
return nil if status.metadata[grpc_status_details_bin_trailer].nil?
|
32
|
+
Google::Rpc::Status.decode(
|
33
|
+
status.metadata[grpc_status_details_bin_trailer])
|
26
34
|
end
|
27
35
|
end
|
28
36
|
end
|
@@ -31,12 +31,11 @@ describe 'conversion from a status struct to a google protobuf status' do
|
|
31
31
|
expect(exception.message.include?('bad type')).to be true
|
32
32
|
end
|
33
33
|
|
34
|
-
it '
|
34
|
+
it 'returns nil if the header key is missing' do
|
35
35
|
status = Struct::Status.new(1, 'details', key: 'val')
|
36
36
|
expect(status.metadata.nil?).to be false
|
37
|
-
expect
|
38
|
-
|
39
|
-
end.to raise_error(StandardError)
|
37
|
+
expect(GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(
|
38
|
+
status)).to be(nil)
|
40
39
|
end
|
41
40
|
|
42
41
|
it 'fails with some error if the header key fails to deserialize' do
|
@@ -221,3 +220,73 @@ describe 'receving a google rpc status from a remote endpoint' do
|
|
221
220
|
status_from_exception)).to eq(rpc_status)
|
222
221
|
end
|
223
222
|
end
|
223
|
+
|
224
|
+
# A test service that fails without explicitly setting the
|
225
|
+
# grpc-status-details-bin trailer. Tests assumptions about value
|
226
|
+
# of grpc-status-details-bin on the client side when the trailer wasn't
|
227
|
+
# set explicitly.
|
228
|
+
class NoStatusDetailsBinTestService
|
229
|
+
include GRPC::GenericService
|
230
|
+
rpc :an_rpc, EchoMsg, EchoMsg
|
231
|
+
|
232
|
+
def an_rpc(_, _)
|
233
|
+
fail GRPC::Unknown
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
NoStatusDetailsBinTestServiceStub = NoStatusDetailsBinTestService.rpc_stub_class
|
238
|
+
|
239
|
+
describe 'when the endpoint doesnt send grpc-status-details-bin' do
|
240
|
+
def start_server
|
241
|
+
@srv = GRPC::RpcServer.new(pool_size: 1)
|
242
|
+
@server_port = @srv.add_http2_port('localhost:0',
|
243
|
+
:this_port_is_insecure)
|
244
|
+
@srv.handle(NoStatusDetailsBinTestService)
|
245
|
+
@server_thd = Thread.new { @srv.run }
|
246
|
+
@srv.wait_till_running
|
247
|
+
end
|
248
|
+
|
249
|
+
def stop_server
|
250
|
+
expect(@srv.stopped?).to be(false)
|
251
|
+
@srv.stop
|
252
|
+
@server_thd.join
|
253
|
+
expect(@srv.stopped?).to be(true)
|
254
|
+
end
|
255
|
+
|
256
|
+
before(:each) do
|
257
|
+
start_server
|
258
|
+
end
|
259
|
+
|
260
|
+
after(:each) do
|
261
|
+
stop_server
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'should receive nil when we extract try to extract a google '\
|
265
|
+
'rpc status from a BadStatus exception that didnt have it' do
|
266
|
+
stub = NoStatusDetailsBinTestServiceStub.new("localhost:#{@server_port}",
|
267
|
+
:this_channel_is_insecure)
|
268
|
+
begin
|
269
|
+
stub.an_rpc(EchoMsg.new)
|
270
|
+
rescue GRPC::Unknown => e
|
271
|
+
rpc_status = GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(
|
272
|
+
e.to_status)
|
273
|
+
end
|
274
|
+
expect(rpc_status).to be(nil)
|
275
|
+
end
|
276
|
+
|
277
|
+
it 'should receive nil when we extract try to extract a google '\
|
278
|
+
'rpc status from an op views status object that didnt have it' do
|
279
|
+
stub = NoStatusDetailsBinTestServiceStub.new("localhost:#{@server_port}",
|
280
|
+
:this_channel_is_insecure)
|
281
|
+
op = stub.an_rpc(EchoMsg.new, return_op: true)
|
282
|
+
begin
|
283
|
+
op.execute
|
284
|
+
rescue GRPC::Unknown => e
|
285
|
+
status_from_exception = e.to_status
|
286
|
+
end
|
287
|
+
expect(GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(
|
288
|
+
status_from_exception)).to be(nil)
|
289
|
+
expect(GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(
|
290
|
+
op.status)).to be nil
|
291
|
+
end
|
292
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- gRPC Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: src/ruby/bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|