grpc 1.34.0-universal-darwin → 1.37.0-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.

Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/etc/roots.pem +257 -573
  3. data/src/ruby/ext/grpc/extconf.rb +9 -1
  4. data/src/ruby/ext/grpc/rb_channel.c +10 -1
  5. data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -1
  6. data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
  7. data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
  8. data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
  9. data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
  10. data/src/ruby/ext/grpc/rb_grpc.c +4 -0
  11. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +14 -0
  12. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +34 -13
  13. data/src/ruby/ext/grpc/rb_server.c +13 -1
  14. data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
  15. data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
  16. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
  17. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
  18. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
  19. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
  20. data/src/ruby/lib/grpc/2.4/grpc_c.bundle +0 -0
  21. data/src/ruby/lib/grpc/2.5/grpc_c.bundle +0 -0
  22. data/src/ruby/lib/grpc/2.6/grpc_c.bundle +0 -0
  23. data/src/ruby/lib/grpc/2.7/grpc_c.bundle +0 -0
  24. data/src/ruby/lib/grpc/3.0/grpc_c.bundle +0 -0
  25. data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
  26. data/src/ruby/lib/grpc/version.rb +1 -1
  27. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +35 -0
  28. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +18 -0
  29. data/src/ruby/pb/test/xds_client.rb +166 -25
  30. data/src/ruby/spec/call_spec.rb +1 -1
  31. data/src/ruby/spec/channel_credentials_spec.rb +32 -0
  32. data/src/ruby/spec/channel_spec.rb +17 -6
  33. data/src/ruby/spec/client_auth_spec.rb +27 -1
  34. data/src/ruby/spec/errors_spec.rb +1 -1
  35. data/src/ruby/spec/generic/active_call_spec.rb +2 -2
  36. data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
  37. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
  38. data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
  39. data/src/ruby/spec/server_credentials_spec.rb +25 -0
  40. data/src/ruby/spec/server_spec.rb +22 -0
  41. metadata +15 -11
  42. data/src/ruby/lib/grpc/2.3/grpc_c.bundle +0 -0
@@ -53,7 +53,7 @@ describe GRPC::Core::Channel do
53
53
  shared_examples '#new' do
54
54
  it 'take a host name without channel args' do
55
55
  blk = proc do
56
- GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure)
56
+ GRPC::Core::Channel.new('phony_host', nil, :this_channel_is_insecure)
57
57
  end
58
58
  expect(&blk).not_to raise_error
59
59
  end
@@ -114,7 +114,7 @@ describe GRPC::Core::Channel do
114
114
 
115
115
  describe '#new for secure channels' do
116
116
  def construct_with_args(a)
117
- proc { GRPC::Core::Channel.new('dummy_host', a, create_test_cert) }
117
+ proc { GRPC::Core::Channel.new('phony_host', a, create_test_cert) }
118
118
  end
119
119
 
120
120
  it_behaves_like '#new'
@@ -125,7 +125,18 @@ describe GRPC::Core::Channel do
125
125
 
126
126
  def construct_with_args(a)
127
127
  proc do
128
- GRPC::Core::Channel.new('dummy_host', a, :this_channel_is_insecure)
128
+ GRPC::Core::Channel.new('phony_host', a, :this_channel_is_insecure)
129
+ end
130
+ end
131
+ end
132
+
133
+ describe '#new for XDS channels' do
134
+ it_behaves_like '#new'
135
+
136
+ def construct_with_args(a)
137
+ proc do
138
+ xds_creds = GRPC::Core::XdsChannelCredentials.new(create_test_cert)
139
+ GRPC::Core::Channel.new('dummy_host', a, xds_creds)
129
140
  end
130
141
  end
131
142
  end
@@ -137,7 +148,7 @@ describe GRPC::Core::Channel do
137
148
  deadline = Time.now + 5
138
149
 
139
150
  blk = proc do
140
- ch.create_call(nil, nil, 'dummy_method', nil, deadline)
151
+ ch.create_call(nil, nil, 'phony_method', nil, deadline)
141
152
  end
142
153
  expect(&blk).to_not raise_error
143
154
  end
@@ -148,7 +159,7 @@ describe GRPC::Core::Channel do
148
159
 
149
160
  deadline = Time.now + 5
150
161
  blk = proc do
151
- ch.create_call(nil, nil, 'dummy_method', nil, deadline)
162
+ ch.create_call(nil, nil, 'phony_method', nil, deadline)
152
163
  end
153
164
  expect(&blk).to raise_error(RuntimeError)
154
165
  end
@@ -160,7 +171,7 @@ describe GRPC::Core::Channel do
160
171
 
161
172
  blk = proc do
162
173
  fork_with_propagated_error_message do
163
- ch.create_call(nil, nil, 'dummy_method', nil, deadline)
174
+ ch.create_call(nil, nil, 'phony_method', nil, deadline)
164
175
  end
165
176
  end
166
177
  expect(&blk).to raise_error(RuntimeError, 'grpc cannot be used before and after forking')
@@ -85,7 +85,10 @@ describe 'client-server auth' do
85
85
  poll_period: 1
86
86
  }
87
87
  @srv = new_rpc_server_for_testing(**server_opts)
88
- port = @srv.add_http2_port('0.0.0.0:0', create_server_creds)
88
+ ssl_creds = create_server_creds
89
+ xds_creds = GRPC::Core::XdsServerCredentials.new(ssl_creds)
90
+ port = @srv.add_http2_port('0.0.0.0:0', ssl_creds)
91
+ xds_port = @srv.add_http2_port('0.0.0.0:0', xds_creds)
89
92
  @srv.handle(SslTestService)
90
93
  @srv_thd = Thread.new { @srv.run }
91
94
  @srv.wait_till_running
@@ -98,6 +101,11 @@ describe 'client-server auth' do
98
101
  @stub = SslTestServiceStub.new("localhost:#{port}",
99
102
  create_channel_creds,
100
103
  **client_opts)
104
+ # auth should success as the fallback creds wil be used
105
+ xds_channel_creds = GRPC::Core::XdsChannelCredentials.new(create_channel_creds)
106
+ @xds_stub = SslTestServiceStub.new("localhost:#{xds_port}",
107
+ xds_channel_creds,
108
+ **client_opts)
101
109
  end
102
110
 
103
111
  after(:all) do
@@ -123,4 +131,22 @@ describe 'client-server auth' do
123
131
  responses = @stub.a_bidi_rpc([EchoMsg.new, EchoMsg.new])
124
132
  responses.each { |r| GRPC.logger.info(r) }
125
133
  end
134
+
135
+ it 'xds_client-xds_server ssl fallback auth with unary RPCs' do
136
+ @xds_stub.an_rpc(EchoMsg.new)
137
+ end
138
+
139
+ it 'xds_client-xds_server ssl fallback auth with client streaming RPCs' do
140
+ @xds_stub.a_client_streaming_rpc([EchoMsg.new, EchoMsg.new])
141
+ end
142
+
143
+ it 'xds_client-xds_server ssl fallback auth with server streaming RPCs' do
144
+ responses = @xds_stub.a_server_streaming_rpc(EchoMsg.new)
145
+ responses.each { |r| GRPC.logger.info(r) }
146
+ end
147
+
148
+ it 'xds_client-xds_server ssl fallback auth with bidi RPCs' do
149
+ responses = @xds_stub.a_bidi_rpc([EchoMsg.new, EchoMsg.new])
150
+ responses.each { |r| GRPC.logger.info(r) }
151
+ end
126
152
  end
@@ -131,7 +131,7 @@ describe GRPC::BadStatus do
131
131
 
132
132
  error_msg = 'parse error: to_rpc_status failed'
133
133
  error_desc = '<Google::Protobuf::ParseError> ' \
134
- 'Error occurred during parsing: Invalid wire type'
134
+ 'Error occurred during parsing'
135
135
 
136
136
  # Check that the parse error was logged correctly
137
137
  log_contents = @log_output.read
@@ -198,11 +198,11 @@ describe GRPC::ActiveCall do
198
198
  deadline,
199
199
  started: false)
200
200
 
201
- metadata = { key: 'dummy_val', other: 'other_val' }
201
+ metadata = { key: 'phony_val', other: 'other_val' }
202
202
  expect(@client_call.metadata_sent).to eq(false)
203
203
  @client_call.merge_metadata_to_send(metadata)
204
204
 
205
- message = 'dummy message'
205
+ message = 'phony message'
206
206
 
207
207
  expect(call).to(
208
208
  receive(:run_batch)
@@ -304,7 +304,7 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
304
304
 
305
305
  describe 'via a call operation' do
306
306
  after(:each) do
307
- # make sure op.wait doesn't hang, even if there's a bad status
307
+ # make sure op.wait doesn't freeze, even if there's a bad status
308
308
  @op.wait
309
309
  end
310
310
  def get_response(stub, run_start_call_first: false, credentials: nil)
@@ -406,7 +406,7 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
406
406
 
407
407
  describe 'via a call operation' do
408
408
  after(:each) do
409
- # make sure op.wait doesn't hang, even if there's a bad status
409
+ # make sure op.wait doesn't freeze, even if there's a bad status
410
410
  @op.wait
411
411
  end
412
412
  def get_response(stub, run_start_call_first: false)
@@ -547,7 +547,7 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
547
547
 
548
548
  describe 'via a call operation' do
549
549
  after(:each) do
550
- @op.wait # make sure wait doesn't hang
550
+ @op.wait # make sure wait doesn't freeze
551
551
  end
552
552
  def get_responses(stub, run_start_call_first: false, unmarshal: noop)
553
553
  @op = stub.server_streamer(@method, @sent_msg, noop, unmarshal,
@@ -865,7 +865,7 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
865
865
 
866
866
  describe 'via a call operation' do
867
867
  after(:each) do
868
- @op.wait # make sure wait doesn't hang
868
+ @op.wait # make sure wait doesn't freeze
869
869
  end
870
870
  def get_responses(stub, run_start_call_first: false, deadline: nil,
871
871
  marshal_proc: noop)
@@ -104,7 +104,7 @@ end
104
104
 
105
105
  SynchronizedCancellationStub = SynchronizedCancellationService.rpc_stub_class
106
106
 
107
- # a test service that hangs onto call objects
107
+ # a test service that holds onto call objects
108
108
  # and uses them after the server-side call has been
109
109
  # finished
110
110
  class CheckCallAfterFinishedService
@@ -71,14 +71,10 @@ describe 'Code Generation Options' do
71
71
  end
72
72
 
73
73
  def with_protos(file_paths)
74
- fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG']
75
- bins_sub_dir = ENV['CONFIG']
76
-
77
74
  pb_dir = File.dirname(__FILE__)
78
- bins_dir = File.join('..', '..', '..', '..', '..', 'bins', bins_sub_dir)
79
-
75
+ bins_dir = File.join('..', '..', '..', '..', '..', 'cmake', 'build')
80
76
  plugin = File.join(bins_dir, 'grpc_ruby_plugin')
81
- protoc = File.join(bins_dir, 'protobuf', 'protoc')
77
+ protoc = File.join(bins_dir, 'third_party', 'protobuf', 'protoc')
82
78
 
83
79
  # Generate the service from the proto
84
80
  Dir.mktmpdir(nil, File.dirname(__FILE__)) do |tmp_dir|
@@ -23,6 +23,7 @@ end
23
23
 
24
24
  describe GRPC::Core::ServerCredentials do
25
25
  Creds = GRPC::Core::ServerCredentials
26
+ XdsCreds = GRPC::Core::XdsServerCredentials
26
27
 
27
28
  describe '#new' do
28
29
  it 'can be constructed from a fake CA PEM, server PEM and a server key' do
@@ -75,5 +76,29 @@ describe GRPC::Core::ServerCredentials do
75
76
  blk = proc { Creds.new(nil, cert_pairs, false) }
76
77
  expect(&blk).to_not raise_error
77
78
  end
79
+
80
+ it 'can be constructed with a fallback credential' do
81
+ _, cert_pairs, _ = load_test_certs
82
+ fallback = Creds.new(nil, cert_pairs, false)
83
+ blk = proc { XdsCreds.new(fallback) }
84
+ expect(&blk).to_not raise_error
85
+ end
86
+
87
+ it 'cannot be constructed with nil' do
88
+ blk = proc { XdsCreds.new(nil) }
89
+ expect(&blk).to raise_error TypeError, /expected grpc_server_credentials/
90
+ end
91
+
92
+ it 'cannot be constructed with a non-C-extension object' do
93
+ not_a_fallback = 100
94
+ blk = proc { XdsCreds.new(not_a_fallback) }
95
+ expect(&blk).to raise_error TypeError, /expected grpc_server_credentials/
96
+ end
97
+
98
+ it 'cannot be constructed with a non-ServerCredentials object' do
99
+ not_a_fallback = GRPC::Core::ChannelCredentials.new
100
+ blk = proc { XdsCreds.new(not_a_fallback) }
101
+ expect(&blk).to raise_error TypeError, /expected grpc_server_credentials/
102
+ end
78
103
  end
79
104
  end
@@ -139,6 +139,28 @@ describe Server do
139
139
  expect(&blk).to raise_error(RuntimeError)
140
140
  end
141
141
  end
142
+
143
+ describe 'for xds servers' do
144
+ let(:cert) { create_test_cert }
145
+ let(:xds) { GRPC::Core::XdsServerCredentials.new(cert) }
146
+ it 'runs without failing' do
147
+ blk = proc do
148
+ s = new_core_server_for_testing(nil)
149
+ s.add_http2_port('localhost:0', xds)
150
+ s.shutdown_and_notify(nil)
151
+ s.close
152
+ end
153
+ expect(&blk).to_not raise_error
154
+ end
155
+
156
+ it 'fails if the server is closed' do
157
+ s = new_core_server_for_testing(nil)
158
+ s.shutdown_and_notify(nil)
159
+ s.close
160
+ blk = proc { s.add_http2_port('localhost:0', xds) }
161
+ expect(&blk).to raise_error(RuntimeError)
162
+ end
163
+ end
142
164
  end
143
165
 
144
166
  shared_examples '#new' do
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.34.0
4
+ version: 1.37.0
5
5
  platform: universal-darwin
6
6
  authors:
7
7
  - gRPC Authors
8
- autorequire:
8
+ autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2021-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.13'
19
+ version: '3.15'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.13'
26
+ version: '3.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: googleapis-common-protos-types
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -245,12 +245,16 @@ files:
245
245
  - src/ruby/ext/grpc/rb_server.h
246
246
  - src/ruby/ext/grpc/rb_server_credentials.c
247
247
  - src/ruby/ext/grpc/rb_server_credentials.h
248
+ - src/ruby/ext/grpc/rb_xds_channel_credentials.c
249
+ - src/ruby/ext/grpc/rb_xds_channel_credentials.h
250
+ - src/ruby/ext/grpc/rb_xds_server_credentials.c
251
+ - src/ruby/ext/grpc/rb_xds_server_credentials.h
248
252
  - src/ruby/lib/grpc.rb
249
- - src/ruby/lib/grpc/2.3/grpc_c.bundle
250
253
  - src/ruby/lib/grpc/2.4/grpc_c.bundle
251
254
  - src/ruby/lib/grpc/2.5/grpc_c.bundle
252
255
  - src/ruby/lib/grpc/2.6/grpc_c.bundle
253
256
  - src/ruby/lib/grpc/2.7/grpc_c.bundle
257
+ - src/ruby/lib/grpc/3.0/grpc_c.bundle
254
258
  - src/ruby/lib/grpc/core/status_codes.rb
255
259
  - src/ruby/lib/grpc/core/time_consts.rb
256
260
  - src/ruby/lib/grpc/errors.rb
@@ -330,7 +334,7 @@ homepage: https://github.com/google/grpc/tree/master/src/ruby
330
334
  licenses:
331
335
  - Apache-2.0
332
336
  metadata: {}
333
- post_install_message:
337
+ post_install_message:
334
338
  rdoc_options: []
335
339
  require_paths:
336
340
  - src/ruby/lib
@@ -340,18 +344,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
340
344
  requirements:
341
345
  - - ">="
342
346
  - !ruby/object:Gem::Version
343
- version: '2.3'
347
+ version: '2.4'
344
348
  - - "<"
345
349
  - !ruby/object:Gem::Version
346
- version: 2.8.dev
350
+ version: 3.1.dev
347
351
  required_rubygems_version: !ruby/object:Gem::Requirement
348
352
  requirements:
349
353
  - - ">="
350
354
  - !ruby/object:Gem::Version
351
355
  version: '0'
352
356
  requirements: []
353
- rubygems_version: 3.1.4
354
- signing_key:
357
+ rubygems_version: 3.2.15
358
+ signing_key:
355
359
  specification_version: 4
356
360
  summary: GRPC system in Ruby
357
361
  test_files:
Binary file