grpc 1.6.2-universal-darwin → 1.6.4-universal-darwin
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c2e00310bf8fe5502fe0696b9659231a0fa80a2
|
4
|
+
data.tar.gz: 346ab5fe39f410d5509764021ab701bb8271a3b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 683e21b438c56ed437d492026d844597ccee98bb6e7f42c1a13259ae50fa540a37bacdf4a166c20c34a9f676cb3fdad7beea63b0aa658dcf38c21e84f81d9699
|
7
|
+
data.tar.gz: a8e93990a590be9d19025ccc996e244c5a763ab79bb4b1500c7916db7004221f5c6a2a00b54e37ea7f818b0ef1066bac47e47804ad5ddeedf2933709c5bbff9b
|
@@ -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: universal-darwin
|
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
|