grpc 1.6.0-x86-mingw32 → 1.6.2-x86-mingw32

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: f41f2675f368dc1e67f4bf3ce5d2f5635eede7eb
4
- data.tar.gz: fd2d430915a45c6be2aae34b5b2deba59777e2d1
3
+ metadata.gz: 2cf3364bb563cea598fb48c00c95c948c6bb7d7d
4
+ data.tar.gz: 15c8699c906ec72e388dff07da7efaf6f57b5d45
5
5
  SHA512:
6
- metadata.gz: 83ae21a7aa1bdeca0316a40674a1b3fa9c40d47cde7dcc97e4a34329b5763473da0ab604f1b45a20fac025ea4233584a3ed760fd4099c032d2ee6107c2a6d9e8
7
- data.tar.gz: da7771eae61211ee907374f2b432485c72a583e8084f5e2f75ed9bc5932c66e1859f1d119602cecbc9076b1d9e4e92b52b53c88a536a41a4e6cee85121cd0fc7
6
+ metadata.gz: 128a361335b0d59b18b1fd7cc241019e5d57b664101e8040d7dd1b7f38946f2f8f1e3f08bb01383c8a6ac9f895cde7bc6142a0abeccd75b34672ae36304d056a
7
+ data.tar.gz: 329bd870c918b2ea06af5ecfac5fc2a7f12271a48aa9e836209ab1ddf84dd5450e21e3e6925568788ff4389710f5d29ce8142d3ca786e054120fd3ea255aced6
Binary file
Binary file
@@ -0,0 +1,28 @@
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
+
15
+ require_relative './grpc'
16
+ require 'google/rpc/status_pb'
17
+
18
+ # GRPC contains the General RPC module.
19
+ module GRPC
20
+ # GoogleRpcStatusUtils provides utilities to convert between a
21
+ # GRPC::Core::Status and a deserialized Google::Rpc::Status proto
22
+ class GoogleRpcStatusUtils
23
+ def self.extract_google_rpc_status(status)
24
+ fail ArgumentError, 'bad type' unless status.is_a? Struct::Status
25
+ Google::Rpc::Status.decode(status.metadata['grpc-status-details-bin'])
26
+ end
27
+ end
28
+ end
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.6.0'
17
+ VERSION = '1.6.2'
18
18
  end
@@ -0,0 +1,223 @@
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
+
15
+ require 'grpc'
16
+ require_relative '../lib/grpc/google_rpc_status_utils'
17
+ require_relative '../pb/src/proto/grpc/testing/messages_pb'
18
+ require_relative '../pb/src/proto/grpc/testing/messages_pb'
19
+ require 'google/protobuf/well_known_types'
20
+
21
+ include GRPC::Core
22
+
23
+ describe 'conversion from a status struct to a google protobuf status' do
24
+ it 'fails if the input is not a status struct' do
25
+ begin
26
+ GRPC::GoogleRpcStatusUtils.extract_google_rpc_status('string')
27
+ rescue => e
28
+ exception = e
29
+ end
30
+ expect(exception.is_a?(ArgumentError)).to be true
31
+ expect(exception.message.include?('bad type')).to be true
32
+ end
33
+
34
+ it 'fails with some error if the header key is missing' do
35
+ status = Struct::Status.new(1, 'details', key: 'val')
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)
40
+ end
41
+
42
+ it 'fails with some error if the header key fails to deserialize' do
43
+ status = Struct::Status.new(1, 'details',
44
+ 'grpc-status-details-bin' => 'string_val')
45
+ expect do
46
+ GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(status)
47
+ end.to raise_error(StandardError)
48
+ end
49
+
50
+ it 'silently ignores erroneous mismatch between messages in '\
51
+ 'status struct and protobuf status' do
52
+ proto = Google::Rpc::Status.new(code: 1, message: 'proto message')
53
+ encoded_proto = Google::Rpc::Status.encode(proto)
54
+ status = Struct::Status.new(1, 'struct message',
55
+ 'grpc-status-details-bin' => encoded_proto)
56
+ rpc_status = GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(status)
57
+ expect(rpc_status).to eq(proto)
58
+ end
59
+
60
+ it 'silently ignores erroneous mismatch between codes in status struct '\
61
+ 'and protobuf status' do
62
+ proto = Google::Rpc::Status.new(code: 1, message: 'matching message')
63
+ encoded_proto = Google::Rpc::Status.encode(proto)
64
+ status = Struct::Status.new(2, 'matching message',
65
+ 'grpc-status-details-bin' => encoded_proto)
66
+ rpc_status = GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(status)
67
+ expect(rpc_status).to eq(proto)
68
+ end
69
+
70
+ it 'can succesfully convert a status struct into a google protobuf status '\
71
+ 'when there are no rpcstatus details' do
72
+ proto = Google::Rpc::Status.new(code: 1, message: 'matching message')
73
+ encoded_proto = Google::Rpc::Status.encode(proto)
74
+ status = Struct::Status.new(1, 'matching message',
75
+ 'grpc-status-details-bin' => encoded_proto)
76
+ out = GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(status)
77
+ expect(out.code).to eq(1)
78
+ expect(out.message).to eq('matching message')
79
+ expect(out.details).to eq([])
80
+ end
81
+
82
+ it 'can succesfully convert a status struct into a google protobuf '\
83
+ 'status when there are multiple rpcstatus details' do
84
+ simple_request_any = Google::Protobuf::Any.new
85
+ simple_request = Grpc::Testing::SimpleRequest.new(
86
+ payload: Grpc::Testing::Payload.new(body: 'request'))
87
+ simple_request_any.pack(simple_request)
88
+ simple_response_any = Google::Protobuf::Any.new
89
+ simple_response = Grpc::Testing::SimpleResponse.new(
90
+ payload: Grpc::Testing::Payload.new(body: 'response'))
91
+ simple_response_any.pack(simple_response)
92
+ payload_any = Google::Protobuf::Any.new
93
+ payload = Grpc::Testing::Payload.new(body: 'payload')
94
+ payload_any.pack(payload)
95
+ proto = Google::Rpc::Status.new(code: 1,
96
+ message: 'matching message',
97
+ details: [
98
+ simple_request_any,
99
+ simple_response_any,
100
+ payload_any
101
+ ])
102
+ encoded_proto = Google::Rpc::Status.encode(proto)
103
+ status = Struct::Status.new(1, 'matching message',
104
+ 'grpc-status-details-bin' => encoded_proto)
105
+ out = GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(status)
106
+ expect(out.code).to eq(1)
107
+ expect(out.message).to eq('matching message')
108
+ expect(out.details[0].unpack(
109
+ Grpc::Testing::SimpleRequest)).to eq(simple_request)
110
+ expect(out.details[1].unpack(
111
+ Grpc::Testing::SimpleResponse)).to eq(simple_response)
112
+ expect(out.details[2].unpack(
113
+ Grpc::Testing::Payload)).to eq(payload)
114
+ end
115
+ end
116
+
117
+ # Test message
118
+ class EchoMsg
119
+ def self.marshal(_o)
120
+ ''
121
+ end
122
+
123
+ def self.unmarshal(_o)
124
+ EchoMsg.new
125
+ end
126
+ end
127
+
128
+ # A test service that fills in the "reserved" grpc-status-details-bin trailer,
129
+ # for client-side testing of GoogleRpcStatus protobuf extraction from trailers.
130
+ class GoogleRpcStatusTestService
131
+ include GRPC::GenericService
132
+ rpc :an_rpc, EchoMsg, EchoMsg
133
+
134
+ def initialize(encoded_rpc_status)
135
+ @encoded_rpc_status = encoded_rpc_status
136
+ end
137
+
138
+ def an_rpc(_, _)
139
+ # TODO: create a server-side utility API for sending a google rpc status.
140
+ # Applications are not expected to set the grpc-status-details-bin
141
+ # ("grpc"-fixed and reserved for library use) manually.
142
+ # Doing so here is only for testing of the client-side api for extracting
143
+ # a google rpc status, which is useful
144
+ # when the interacting with a server that does fill in this trailer.
145
+ fail GRPC::Unknown.new('test message',
146
+ 'grpc-status-details-bin' => @encoded_rpc_status)
147
+ end
148
+ end
149
+
150
+ GoogleRpcStatusTestStub = GoogleRpcStatusTestService.rpc_stub_class
151
+
152
+ describe 'receving a google rpc status from a remote endpoint' do
153
+ def start_server(encoded_rpc_status)
154
+ @srv = GRPC::RpcServer.new(pool_size: 1)
155
+ @server_port = @srv.add_http2_port('localhost:0',
156
+ :this_port_is_insecure)
157
+ @srv.handle(GoogleRpcStatusTestService.new(encoded_rpc_status))
158
+ @server_thd = Thread.new { @srv.run }
159
+ @srv.wait_till_running
160
+ end
161
+
162
+ def stop_server
163
+ expect(@srv.stopped?).to be(false)
164
+ @srv.stop
165
+ @server_thd.join
166
+ expect(@srv.stopped?).to be(true)
167
+ end
168
+
169
+ before(:each) do
170
+ simple_request_any = Google::Protobuf::Any.new
171
+ simple_request = Grpc::Testing::SimpleRequest.new(
172
+ payload: Grpc::Testing::Payload.new(body: 'request'))
173
+ simple_request_any.pack(simple_request)
174
+ simple_response_any = Google::Protobuf::Any.new
175
+ simple_response = Grpc::Testing::SimpleResponse.new(
176
+ payload: Grpc::Testing::Payload.new(body: 'response'))
177
+ simple_response_any.pack(simple_response)
178
+ payload_any = Google::Protobuf::Any.new
179
+ payload = Grpc::Testing::Payload.new(body: 'payload')
180
+ payload_any.pack(payload)
181
+ @expected_proto = Google::Rpc::Status.new(
182
+ code: StatusCodes::UNKNOWN,
183
+ message: 'test message',
184
+ details: [simple_request_any, simple_response_any, payload_any])
185
+ start_server(Google::Rpc::Status.encode(@expected_proto))
186
+ end
187
+
188
+ after(:each) do
189
+ stop_server
190
+ end
191
+
192
+ it 'should receive be able to extract a google rpc status from the '\
193
+ 'status struct taken from a BadStatus exception' do
194
+ stub = GoogleRpcStatusTestStub.new("localhost:#{@server_port}",
195
+ :this_channel_is_insecure)
196
+ begin
197
+ stub.an_rpc(EchoMsg.new)
198
+ rescue GRPC::BadStatus => e
199
+ rpc_status = GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(
200
+ e.to_status)
201
+ end
202
+ expect(rpc_status).to eq(@expected_proto)
203
+ end
204
+
205
+ it 'should receive be able to extract a google rpc status from the '\
206
+ 'status struct taken from the op view of a call' do
207
+ stub = GoogleRpcStatusTestStub.new("localhost:#{@server_port}",
208
+ :this_channel_is_insecure)
209
+ op = stub.an_rpc(EchoMsg.new, return_op: true)
210
+ begin
211
+ op.execute
212
+ rescue GRPC::BadStatus => e
213
+ status_from_exception = e.to_status
214
+ end
215
+ rpc_status = GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(
216
+ op.status)
217
+ expect(rpc_status).to eq(@expected_proto)
218
+ # "to_status" on the bad status should give the same result
219
+ # as "status" on the "op view".
220
+ expect(GRPC::GoogleRpcStatusUtils.extract_google_rpc_status(
221
+ status_from_exception)).to eq(rpc_status)
222
+ end
223
+ 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.0
4
+ version: 1.6.2
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.5.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: googleapis-common-protos-types
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -240,6 +254,7 @@ files:
240
254
  - src/ruby/lib/grpc/generic/rpc_desc.rb
241
255
  - src/ruby/lib/grpc/generic/rpc_server.rb
242
256
  - src/ruby/lib/grpc/generic/service.rb
257
+ - src/ruby/lib/grpc/google_rpc_status_utils.rb
243
258
  - src/ruby/lib/grpc/grpc.rb
244
259
  - src/ruby/lib/grpc/grpc_c.so
245
260
  - src/ruby/lib/grpc/logconfig.rb
@@ -274,6 +289,7 @@ files:
274
289
  - src/ruby/spec/generic/rpc_server_pool_spec.rb
275
290
  - src/ruby/spec/generic/rpc_server_spec.rb
276
291
  - src/ruby/spec/generic/service_spec.rb
292
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
277
293
  - src/ruby/spec/pb/duplicate/codegen_spec.rb
278
294
  - src/ruby/spec/pb/health/checker_spec.rb
279
295
  - src/ruby/spec/server_credentials_spec.rb
@@ -326,6 +342,7 @@ test_files:
326
342
  - src/ruby/spec/testdata/server1.pem
327
343
  - src/ruby/spec/testdata/client.key
328
344
  - src/ruby/spec/time_consts_spec.rb
345
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
329
346
  - src/ruby/spec/channel_connection_spec.rb
330
347
  - src/ruby/spec/call_spec.rb
331
348
  - src/ruby/spec/generic/rpc_server_spec.rb