grpc 1.6.2 → 1.6.4

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: 6420473df99c7304193775fb989314d7c6b7ba23
4
- data.tar.gz: 919eacd2969e2b55532f677b232c6726dc017e3f
3
+ metadata.gz: ddc3cb53a7c493a1fb14171eeff8f781784dbf2b
4
+ data.tar.gz: 1917220d2418c5422155994d3317af6fad5bbdf0
5
5
  SHA512:
6
- metadata.gz: b2968cc946b4c07ca2bf19d5d0e7d8a628fd58e3c187e21509849d42caa7062b3f53fc35c4496b2459f682f97e93c6907ef0130b46ec7c1f344d3622e57ff604
7
- data.tar.gz: 9207834cea409f50235d25764d35f5dc7e96946719ce40e584420d594b8c590ea9bd5c5fbf747f0812d3a7ddbfb36186537e68115b0f56c4636bca84491b3705
6
+ metadata.gz: 55962341420e640fb72c564fa2e12630d0daea90dedfbac00a5ab09e2b2e89e109d3cddf6fd241c2dfa05a2783ce4a3a2daeaa2cf1aa67e9b5a21cda5aac01c5
7
+ data.tar.gz: 49efddfa4747aeca28cdab4912657b5fba5bc6892e3b653da2e98343d352d4fd805949b76297c0786d5bf42539f0c8823dba198db8ba4ca25de7615e2be1d166
data/Makefile CHANGED
@@ -411,8 +411,8 @@ Q = @
411
411
  endif
412
412
 
413
413
  CORE_VERSION = 4.0.0
414
- CPP_VERSION = 1.6.2
415
- CSHARP_VERSION = 1.6.2
414
+ CPP_VERSION = 1.6.4
415
+ CSHARP_VERSION = 1.6.4
416
416
 
417
417
  CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
418
418
  CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@@ -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
- Google::Rpc::Status.decode(status.metadata['grpc-status-details-bin'])
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
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.6.2'
17
+ VERSION = '1.6.4'
18
18
  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 'fails with some error if the header key is missing' do
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 do
38
- GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(status)
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.2
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2017-09-22 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf