grpc 1.36.0-x86-linux → 1.38.0-x86-linux

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/src/ruby/bin/math_services_pb.rb +1 -1
  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_grpc.c +4 -0
  10. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  11. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -1
  12. data/src/ruby/ext/grpc/rb_server.c +13 -1
  13. data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
  14. data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
  15. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
  16. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
  17. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
  18. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
  19. data/src/ruby/lib/grpc/2.4/grpc_c.so +0 -0
  20. data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
  21. data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
  22. data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
  23. data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
  24. data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
  25. data/src/ruby/lib/grpc/version.rb +1 -1
  26. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +1 -1
  27. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +6 -6
  28. data/src/ruby/pb/test/xds_client.rb +41 -27
  29. data/src/ruby/spec/call_spec.rb +1 -1
  30. data/src/ruby/spec/channel_credentials_spec.rb +32 -0
  31. data/src/ruby/spec/channel_spec.rb +17 -6
  32. data/src/ruby/spec/client_auth_spec.rb +27 -1
  33. data/src/ruby/spec/errors_spec.rb +1 -1
  34. data/src/ruby/spec/generic/active_call_spec.rb +2 -2
  35. data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
  36. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
  37. data/src/ruby/spec/server_credentials_spec.rb +25 -0
  38. data/src/ruby/spec/server_spec.rb +22 -0
  39. metadata +38 -34
@@ -171,7 +171,7 @@ describe GRPC::Core::Call do
171
171
  end
172
172
 
173
173
  def make_test_call
174
- @ch.create_call(nil, nil, 'dummy_method', nil, deadline)
174
+ @ch.create_call(nil, nil, 'phony_method', nil, deadline)
175
175
  end
176
176
 
177
177
  def deadline
@@ -60,6 +60,38 @@ describe GRPC::Core::ChannelCredentials do
60
60
  blk = proc { GRPC::Core::ChannelCredentials.new(nil, '', nil) }
61
61
  expect(&blk).to raise_error
62
62
  end
63
+
64
+ it 'can be constructed with a fallback credential' do
65
+ blk = proc {
66
+ fallback = GRPC::Core::ChannelCredentials.new
67
+ GRPC::Core::XdsChannelCredentials.new(fallback)
68
+ }
69
+ expect(&blk).not_to raise_error
70
+ end
71
+
72
+ it 'fails gracefully constructed with nil' do
73
+ blk = proc {
74
+ GRPC::Core::XdsChannelCredentials.new(nil)
75
+ }
76
+ expect(&blk).to raise_error TypeError, /expected grpc_channel_credentials/
77
+ end
78
+
79
+ it 'fails gracefully constructed with a non-C-extension object' do
80
+ blk = proc {
81
+ not_a_fallback = 100
82
+ GRPC::Core::XdsChannelCredentials.new(not_a_fallback)
83
+ }
84
+ expect(&blk).to raise_error TypeError, /expected grpc_channel_credentials/
85
+ end
86
+
87
+ it 'fails gracefully constructed with a non-ChannelCredentials object' do
88
+ blk = proc {
89
+ not_a_fallback = GRPC::Core::Channel.new('dummy_host', nil,
90
+ :this_channel_is_insecure)
91
+ GRPC::Core::XdsChannelCredentials.new(not_a_fallback)
92
+ }
93
+ expect(&blk).to raise_error TypeError, /expected grpc_channel_credentials/
94
+ end
63
95
  end
64
96
 
65
97
  describe '#compose' do
@@ -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
@@ -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.36.0
4
+ version: 1.38.0
5
5
  platform: x86-linux
6
6
  authors:
7
7
  - gRPC Authors
8
8
  autorequire:
9
9
  bindir: src/ruby/bin
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-05-20 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.14'
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.14'
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,6 +245,10 @@ 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
253
  - src/ruby/lib/grpc/2.4/grpc_c.so
250
254
  - src/ruby/lib/grpc/2.5/grpc_c.so
@@ -350,51 +354,51 @@ required_rubygems_version: !ruby/object:Gem::Requirement
350
354
  - !ruby/object:Gem::Version
351
355
  version: '0'
352
356
  requirements: []
353
- rubygems_version: 3.2.11
357
+ rubygems_version: 3.2.17
354
358
  signing_key:
355
359
  specification_version: 4
356
360
  summary: GRPC system in Ruby
357
361
  test_files:
358
- - src/ruby/spec/client_server_spec.rb
359
- - src/ruby/spec/debug_message_spec.rb
360
- - src/ruby/spec/user_agent_spec.rb
361
- - src/ruby/spec/support/helpers.rb
362
- - src/ruby/spec/support/services.rb
363
- - src/ruby/spec/client_auth_spec.rb
364
- - src/ruby/spec/channel_connection_spec.rb
365
- - src/ruby/spec/errors_spec.rb
366
- - src/ruby/spec/spec_helper.rb
367
- - src/ruby/spec/error_sanity_spec.rb
368
- - src/ruby/spec/server_credentials_spec.rb
369
- - src/ruby/spec/testdata/client.pem
370
- - src/ruby/spec/testdata/ca.pem
371
- - src/ruby/spec/testdata/server1.key
362
+ - src/ruby/spec/testdata/server1.pem
372
363
  - src/ruby/spec/testdata/client.key
364
+ - src/ruby/spec/testdata/ca.pem
373
365
  - src/ruby/spec/testdata/README
374
- - src/ruby/spec/testdata/server1.pem
375
- - src/ruby/spec/channel_credentials_spec.rb
376
- - src/ruby/spec/google_rpc_status_utils_spec.rb
377
- - src/ruby/spec/time_consts_spec.rb
378
- - src/ruby/spec/server_spec.rb
379
- - src/ruby/spec/call_spec.rb
366
+ - src/ruby/spec/testdata/client.pem
367
+ - src/ruby/spec/testdata/server1.key
380
368
  - src/ruby/spec/compression_options_spec.rb
381
- - src/ruby/spec/channel_spec.rb
382
- - src/ruby/spec/pb/duplicate/codegen_spec.rb
369
+ - src/ruby/spec/error_sanity_spec.rb
370
+ - src/ruby/spec/user_agent_spec.rb
371
+ - src/ruby/spec/call_spec.rb
383
372
  - src/ruby/spec/pb/health/checker_spec.rb
384
- - src/ruby/spec/pb/codegen/package_option_spec.rb
385
- - src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto
386
- - src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto
373
+ - src/ruby/spec/pb/duplicate/codegen_spec.rb
387
374
  - src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto
375
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto
388
376
  - src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
377
+ - src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto
389
378
  - src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto
390
379
  - src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto
380
+ - src/ruby/spec/pb/codegen/package_option_spec.rb
391
381
  - src/ruby/spec/call_credentials_spec.rb
392
- - src/ruby/spec/generic/server_interceptors_spec.rb
382
+ - src/ruby/spec/channel_connection_spec.rb
383
+ - src/ruby/spec/channel_credentials_spec.rb
384
+ - src/ruby/spec/client_server_spec.rb
385
+ - src/ruby/spec/server_spec.rb
386
+ - src/ruby/spec/spec_helper.rb
387
+ - src/ruby/spec/support/helpers.rb
388
+ - src/ruby/spec/support/services.rb
389
+ - src/ruby/spec/errors_spec.rb
390
+ - src/ruby/spec/channel_spec.rb
391
+ - src/ruby/spec/server_credentials_spec.rb
392
+ - src/ruby/spec/client_auth_spec.rb
393
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
394
+ - src/ruby/spec/debug_message_spec.rb
395
+ - src/ruby/spec/time_consts_spec.rb
396
+ - src/ruby/spec/generic/client_interceptors_spec.rb
397
+ - src/ruby/spec/generic/active_call_spec.rb
398
+ - src/ruby/spec/generic/rpc_server_pool_spec.rb
393
399
  - src/ruby/spec/generic/rpc_server_spec.rb
394
400
  - src/ruby/spec/generic/interceptor_registry_spec.rb
395
401
  - src/ruby/spec/generic/rpc_desc_spec.rb
396
- - src/ruby/spec/generic/rpc_server_pool_spec.rb
397
402
  - src/ruby/spec/generic/client_stub_spec.rb
398
- - src/ruby/spec/generic/client_interceptors_spec.rb
399
403
  - src/ruby/spec/generic/service_spec.rb
400
- - src/ruby/spec/generic/active_call_spec.rb
404
+ - src/ruby/spec/generic/server_interceptors_spec.rb