grpc 1.4.1-x86-mingw32 → 1.4.5-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.

@@ -53,14 +53,14 @@ describe GRPC::RpcDesc do
53
53
 
54
54
  shared_examples 'it handles errors' do
55
55
  it 'sends the specified status if BadStatus is raised' do
56
- expect(@call).to receive(:remote_read).once.and_return(Object.new)
56
+ expect(@call).to receive(:read_unary_request).once.and_return(Object.new)
57
57
  expect(@call).to receive(:send_status).once.with(@bs_code, 'NOK', false,
58
58
  metadata: {})
59
59
  this_desc.run_server_method(@call, method(:bad_status))
60
60
  end
61
61
 
62
62
  it 'sends status UNKNOWN if other StandardErrors are raised' do
63
- expect(@call).to receive(:remote_read).once.and_return(Object.new)
63
+ expect(@call).to receive(:read_unary_request).once.and_return(Object.new)
64
64
  expect(@call).to receive(:send_status).once.with(UNKNOWN,
65
65
  arg_error_msg,
66
66
  false, metadata: {})
@@ -68,7 +68,7 @@ describe GRPC::RpcDesc do
68
68
  end
69
69
 
70
70
  it 'absorbs CallError with no further action' do
71
- expect(@call).to receive(:remote_read).once.and_raise(CallError)
71
+ expect(@call).to receive(:read_unary_request).once.and_raise(CallError)
72
72
  blk = proc do
73
73
  this_desc.run_server_method(@call, method(:fake_reqresp))
74
74
  end
@@ -90,7 +90,7 @@ describe GRPC::RpcDesc do
90
90
 
91
91
  it 'sends a response and closes the stream if there no errors' do
92
92
  req = Object.new
93
- expect(@call).to receive(:remote_read).once.and_return(req)
93
+ expect(@call).to receive(:read_unary_request).once.and_return(req)
94
94
  expect(@call).to receive(:output_metadata).once.and_return(fake_md)
95
95
  expect(@call).to receive(:server_unary_response).once
96
96
  .with(@ok_response, trailing_metadata: fake_md)
@@ -148,7 +148,7 @@ describe GRPC::RpcDesc do
148
148
 
149
149
  it 'sends a response and closes the stream if there no errors' do
150
150
  req = Object.new
151
- expect(@call).to receive(:remote_read).once.and_return(req)
151
+ expect(@call).to receive(:read_unary_request).once.and_return(req)
152
152
  expect(@call).to receive(:remote_send).twice.with(@ok_response)
153
153
  expect(@call).to receive(:output_metadata).and_return(fake_md)
154
154
  expect(@call).to receive(:send_status).once.with(OK, 'OK', true,
@@ -126,6 +126,47 @@ end
126
126
 
127
127
  SlowStub = SlowService.rpc_stub_class
128
128
 
129
+ # a test service that hangs onto call objects
130
+ # and uses them after the server-side call has been
131
+ # finished
132
+ class CheckCallAfterFinishedService
133
+ include GRPC::GenericService
134
+ rpc :an_rpc, EchoMsg, EchoMsg
135
+ rpc :a_client_streaming_rpc, stream(EchoMsg), EchoMsg
136
+ rpc :a_server_streaming_rpc, EchoMsg, stream(EchoMsg)
137
+ rpc :a_bidi_rpc, stream(EchoMsg), stream(EchoMsg)
138
+ attr_reader :server_side_call
139
+
140
+ def an_rpc(req, call)
141
+ fail 'shouldnt reuse service' unless @server_side_call.nil?
142
+ @server_side_call = call
143
+ req
144
+ end
145
+
146
+ def a_client_streaming_rpc(call)
147
+ fail 'shouldnt reuse service' unless @server_side_call.nil?
148
+ @server_side_call = call
149
+ # iterate through requests so call can complete
150
+ call.each_remote_read.each { |r| p r }
151
+ EchoMsg.new
152
+ end
153
+
154
+ def a_server_streaming_rpc(_, call)
155
+ fail 'shouldnt reuse service' unless @server_side_call.nil?
156
+ @server_side_call = call
157
+ [EchoMsg.new, EchoMsg.new]
158
+ end
159
+
160
+ def a_bidi_rpc(requests, call)
161
+ fail 'shouldnt reuse service' unless @server_side_call.nil?
162
+ @server_side_call = call
163
+ requests.each { |r| p r }
164
+ [EchoMsg.new, EchoMsg.new]
165
+ end
166
+ end
167
+
168
+ CheckCallAfterFinishedServiceStub = CheckCallAfterFinishedService.rpc_stub_class
169
+
129
170
  describe GRPC::RpcServer do
130
171
  RpcServer = GRPC::RpcServer
131
172
  StatusCodes = GRPC::Core::StatusCodes
@@ -520,5 +561,109 @@ describe GRPC::RpcServer do
520
561
  t.join
521
562
  end
522
563
  end
564
+
565
+ context 'when call objects are used after calls have completed' do
566
+ before(:each) do
567
+ server_opts = {
568
+ poll_period: 1
569
+ }
570
+ @srv = RpcServer.new(**server_opts)
571
+ alt_port = @srv.add_http2_port('0.0.0.0:0', :this_port_is_insecure)
572
+ @alt_host = "0.0.0.0:#{alt_port}"
573
+
574
+ @service = CheckCallAfterFinishedService.new
575
+ @srv.handle(@service)
576
+ @srv_thd = Thread.new { @srv.run }
577
+ @srv.wait_till_running
578
+ end
579
+
580
+ # check that the server-side call is still in a usable state even
581
+ # after it has finished
582
+ def check_single_req_view_of_finished_call(call)
583
+ common_check_of_finished_server_call(call)
584
+
585
+ expect(call.peer).to be_a(String)
586
+ expect(call.peer_cert).to be(nil)
587
+ end
588
+
589
+ def check_multi_req_view_of_finished_call(call)
590
+ common_check_of_finished_server_call(call)
591
+
592
+ expect do
593
+ call.each_remote_read.each { |r| p r }
594
+ end.to raise_error(GRPC::Core::CallError)
595
+ end
596
+
597
+ def common_check_of_finished_server_call(call)
598
+ expect do
599
+ call.merge_metadata_to_send({})
600
+ end.to raise_error(RuntimeError)
601
+
602
+ expect do
603
+ call.send_initial_metadata
604
+ end.to_not raise_error
605
+
606
+ expect(call.cancelled?).to be(false)
607
+ expect(call.metadata).to be_a(Hash)
608
+ expect(call.metadata['user-agent']).to be_a(String)
609
+
610
+ expect(call.metadata_sent).to be(true)
611
+ expect(call.output_metadata).to eq({})
612
+ expect(call.metadata_to_send).to eq({})
613
+ expect(call.deadline.is_a?(Time)).to be(true)
614
+ end
615
+
616
+ it 'should not crash when call used after an unary call is finished' do
617
+ req = EchoMsg.new
618
+ stub = CheckCallAfterFinishedServiceStub.new(@alt_host,
619
+ :this_channel_is_insecure)
620
+ resp = stub.an_rpc(req)
621
+ expect(resp).to be_a(EchoMsg)
622
+ @srv.stop
623
+ @srv_thd.join
624
+
625
+ check_single_req_view_of_finished_call(@service.server_side_call)
626
+ end
627
+
628
+ it 'should not crash when call used after client streaming finished' do
629
+ requests = [EchoMsg.new, EchoMsg.new]
630
+ stub = CheckCallAfterFinishedServiceStub.new(@alt_host,
631
+ :this_channel_is_insecure)
632
+ resp = stub.a_client_streaming_rpc(requests)
633
+ expect(resp).to be_a(EchoMsg)
634
+ @srv.stop
635
+ @srv_thd.join
636
+
637
+ check_multi_req_view_of_finished_call(@service.server_side_call)
638
+ end
639
+
640
+ it 'should not crash when call used after server streaming finished' do
641
+ req = EchoMsg.new
642
+ stub = CheckCallAfterFinishedServiceStub.new(@alt_host,
643
+ :this_channel_is_insecure)
644
+ responses = stub.a_server_streaming_rpc(req)
645
+ responses.each do |r|
646
+ expect(r).to be_a(EchoMsg)
647
+ end
648
+ @srv.stop
649
+ @srv_thd.join
650
+
651
+ check_single_req_view_of_finished_call(@service.server_side_call)
652
+ end
653
+
654
+ it 'should not crash when call used after a bidi call is finished' do
655
+ requests = [EchoMsg.new, EchoMsg.new]
656
+ stub = CheckCallAfterFinishedServiceStub.new(@alt_host,
657
+ :this_channel_is_insecure)
658
+ responses = stub.a_bidi_rpc(requests)
659
+ responses.each do |r|
660
+ expect(r).to be_a(EchoMsg)
661
+ end
662
+ @srv.stop
663
+ @srv_thd.join
664
+
665
+ check_multi_req_view_of_finished_call(@service.server_side_call)
666
+ end
667
+ end
523
668
  end
524
669
  end
@@ -0,0 +1,16 @@
1
+ -----BEGIN PRIVATE KEY-----
2
+ MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBAOxUR9uhvhbeVUIM
3
+ s5WbH0px0mehl2+6sZpNjzvE2KimZpHzMJHukVH0Ffkvhs0b8+S5Ut9VNUAqd3IM
4
+ JCCAEGtRNoQhM1t9Yr2zAckSvbRacp+FL/Cj9eDmyo00KsVGaeefA4Dh4OW+ZhkT
5
+ NKcldXqkSuj1sEf244JZYuqZp6/tAgMBAAECgYEAi2NSVqpZMafE5YYUTcMGe6QS
6
+ k2jtpsqYgggI2RnLJ/2tNZwYI5pwP8QVSbnMaiF4gokD5hGdrNDfTnb2v+yIwYEH
7
+ 0w8+oG7Z81KodsiZSIDJfTGsAZhVNwO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Qa1E2hCEz
9
+ W31ivbMByRK9tFpyn4Uv8KP14ObKjTQqxUZp558DgOHg5b5mGRM0pyV1eqRK6PWw
10
+ R/bjglli6pmnr+0CAwEAATANBgkqhkiG9w0BAQUFAAOBgQAStSm5PM7ubROiKK6/
11
+ T2FkKlhiTOx+Ryenm3Eio59emq+jXl+1nhPySX5G2PQzSR5vd1dIhwgZSR4Gyttk
12
+ tRZ57k/NI1brUW8joiEOMJA/Mr7H7asx7wIRYDE91Fs8GkKWd5LhoPAQj+qdG35C
13
+ OO+svdkmqH0KZo320ZUqdl2ooQ==
14
+ -----END CERTIFICATE-----
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.4.1
4
+ version: 1.4.5
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-06-27 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -264,6 +264,7 @@ files:
264
264
  - src/ruby/spec/channel_connection_spec.rb
265
265
  - src/ruby/spec/channel_credentials_spec.rb
266
266
  - src/ruby/spec/channel_spec.rb
267
+ - src/ruby/spec/client_auth_spec.rb
267
268
  - src/ruby/spec/client_server_spec.rb
268
269
  - src/ruby/spec/compression_options_spec.rb
269
270
  - src/ruby/spec/error_sanity_spec.rb
@@ -280,6 +281,8 @@ files:
280
281
  - src/ruby/spec/spec_helper.rb
281
282
  - src/ruby/spec/testdata/README
282
283
  - src/ruby/spec/testdata/ca.pem
284
+ - src/ruby/spec/testdata/client.key
285
+ - src/ruby/spec/testdata/client.pem
283
286
  - src/ruby/spec/testdata/server1.key
284
287
  - src/ruby/spec/testdata/server1.pem
285
288
  - src/ruby/spec/time_consts_spec.rb
@@ -315,10 +318,13 @@ summary: GRPC system in Ruby
315
318
  test_files:
316
319
  - src/ruby/spec/server_spec.rb
317
320
  - src/ruby/spec/channel_spec.rb
321
+ - src/ruby/spec/client_auth_spec.rb
318
322
  - src/ruby/spec/testdata/README
319
323
  - src/ruby/spec/testdata/ca.pem
320
324
  - src/ruby/spec/testdata/server1.key
325
+ - src/ruby/spec/testdata/client.pem
321
326
  - src/ruby/spec/testdata/server1.pem
327
+ - src/ruby/spec/testdata/client.key
322
328
  - src/ruby/spec/time_consts_spec.rb
323
329
  - src/ruby/spec/channel_connection_spec.rb
324
330
  - src/ruby/spec/call_spec.rb