grpc 1.6.7-x86-mingw32 → 1.7.0.pre1-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 +4 -4
- data/grpc_c.32.ruby +0 -0
- data/grpc_c.64.ruby +0 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +6 -2
- data/src/ruby/ext/grpc/rb_grpc.c +1 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +30 -20
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +50 -35
- data/src/ruby/lib/grpc.rb +1 -0
- data/src/ruby/lib/grpc/2.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.2/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.3/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.4/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/generic/active_call.rb +34 -9
- data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -10
- data/src/ruby/lib/grpc/generic/client_stub.rb +95 -38
- data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
- data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +66 -20
- data/src/ruby/lib/grpc/generic/rpc_server.rb +15 -3
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +1 -2
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +1 -0
- data/src/ruby/spec/channel_connection_spec.rb +1 -34
- data/src/ruby/spec/client_server_spec.rb +188 -82
- data/src/ruby/spec/generic/active_call_spec.rb +65 -11
- data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
- data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
- data/src/ruby/spec/generic/rpc_desc_spec.rb +38 -0
- data/src/ruby/spec/generic/rpc_server_spec.rb +1 -34
- data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
- data/src/ruby/spec/spec_helper.rb +4 -0
- data/src/ruby/spec/support/helpers.rb +73 -0
- data/src/ruby/spec/support/services.rb +147 -0
- metadata +24 -12
@@ -29,14 +29,18 @@ shared_context 'setup: tags' do
|
|
29
29
|
expect(recvd_rpc).to_not eq nil
|
30
30
|
server_call = recvd_rpc.call
|
31
31
|
ops = { CallOps::SEND_INITIAL_METADATA => metadata }
|
32
|
-
|
33
|
-
expect(
|
32
|
+
server_batch = server_call.run_batch(ops)
|
33
|
+
expect(server_batch.send_metadata).to be true
|
34
34
|
server_call
|
35
35
|
end
|
36
36
|
|
37
37
|
def new_client_call
|
38
38
|
@ch.create_call(nil, nil, '/method', nil, deadline)
|
39
39
|
end
|
40
|
+
|
41
|
+
def ok_status
|
42
|
+
Struct::Status.new(StatusCodes::OK, 'OK')
|
43
|
+
end
|
40
44
|
end
|
41
45
|
|
42
46
|
shared_examples 'basic GRPC message delivery is OK' do
|
@@ -70,19 +74,32 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
70
74
|
|
71
75
|
client_ops = {
|
72
76
|
CallOps::SEND_INITIAL_METADATA => {},
|
73
|
-
CallOps::SEND_MESSAGE => sent_message
|
77
|
+
CallOps::SEND_MESSAGE => sent_message,
|
78
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
74
79
|
}
|
75
|
-
|
76
|
-
expect(
|
77
|
-
expect(
|
80
|
+
client_batch = call.run_batch(client_ops)
|
81
|
+
expect(client_batch.send_metadata).to be true
|
82
|
+
expect(client_batch.send_message).to be true
|
83
|
+
expect(client_batch.send_close).to be true
|
78
84
|
|
79
85
|
# confirm the server can read the inbound message
|
80
86
|
server_thread.join
|
81
87
|
server_ops = {
|
82
|
-
CallOps::RECV_MESSAGE => nil
|
88
|
+
CallOps::RECV_MESSAGE => nil,
|
89
|
+
CallOps::RECV_CLOSE_ON_SERVER => nil,
|
90
|
+
CallOps::SEND_STATUS_FROM_SERVER => ok_status
|
83
91
|
}
|
84
|
-
|
85
|
-
expect(
|
92
|
+
server_batch = server_call.run_batch(server_ops)
|
93
|
+
expect(server_batch.message).to eq(sent_message)
|
94
|
+
expect(server_batch.send_close).to be true
|
95
|
+
expect(server_batch.send_status).to be true
|
96
|
+
|
97
|
+
# finish the call
|
98
|
+
final_client_batch = call.run_batch(
|
99
|
+
CallOps::RECV_INITIAL_METADATA => nil,
|
100
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil)
|
101
|
+
expect(final_client_batch.metadata).to eq({})
|
102
|
+
expect(final_client_batch.status.code).to eq(0)
|
86
103
|
end
|
87
104
|
|
88
105
|
it 'responses written by servers are received by the client' do
|
@@ -95,21 +112,36 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
95
112
|
|
96
113
|
client_ops = {
|
97
114
|
CallOps::SEND_INITIAL_METADATA => {},
|
98
|
-
CallOps::SEND_MESSAGE => sent_message
|
115
|
+
CallOps::SEND_MESSAGE => sent_message,
|
116
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
99
117
|
}
|
100
|
-
|
101
|
-
expect(
|
102
|
-
expect(
|
118
|
+
client_batch = call.run_batch(client_ops)
|
119
|
+
expect(client_batch.send_metadata).to be true
|
120
|
+
expect(client_batch.send_message).to be true
|
121
|
+
expect(client_batch.send_close).to be true
|
103
122
|
|
104
123
|
# confirm the server can read the inbound message
|
105
124
|
server_thread.join
|
106
125
|
server_ops = {
|
107
126
|
CallOps::RECV_MESSAGE => nil,
|
108
|
-
CallOps::
|
127
|
+
CallOps::RECV_CLOSE_ON_SERVER => nil,
|
128
|
+
CallOps::SEND_MESSAGE => reply_text,
|
129
|
+
CallOps::SEND_STATUS_FROM_SERVER => ok_status
|
109
130
|
}
|
110
|
-
|
111
|
-
expect(
|
112
|
-
expect(
|
131
|
+
server_batch = server_call.run_batch(server_ops)
|
132
|
+
expect(server_batch.message).to eq(sent_message)
|
133
|
+
expect(server_batch.send_close).to be true
|
134
|
+
expect(server_batch.send_message).to be true
|
135
|
+
expect(server_batch.send_status).to be true
|
136
|
+
|
137
|
+
# finish the call
|
138
|
+
final_client_batch = call.run_batch(
|
139
|
+
CallOps::RECV_INITIAL_METADATA => nil,
|
140
|
+
CallOps::RECV_MESSAGE => nil,
|
141
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil)
|
142
|
+
expect(final_client_batch.metadata).to eq({})
|
143
|
+
expect(final_client_batch.message).to eq(reply_text)
|
144
|
+
expect(final_client_batch.status.code).to eq(0)
|
113
145
|
end
|
114
146
|
|
115
147
|
it 'compressed messages can be sent and received' do
|
@@ -125,30 +157,37 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
125
157
|
|
126
158
|
client_ops = {
|
127
159
|
CallOps::SEND_INITIAL_METADATA => md,
|
128
|
-
CallOps::SEND_MESSAGE => long_request_str
|
160
|
+
CallOps::SEND_MESSAGE => long_request_str,
|
161
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
129
162
|
}
|
130
|
-
|
131
|
-
expect(
|
132
|
-
expect(
|
163
|
+
client_batch = call.run_batch(client_ops)
|
164
|
+
expect(client_batch.send_metadata).to be true
|
165
|
+
expect(client_batch.send_message).to be true
|
166
|
+
expect(client_batch.send_close).to be true
|
133
167
|
|
134
168
|
# confirm the server can read the inbound message
|
135
169
|
server_thread.join
|
136
170
|
server_ops = {
|
137
171
|
CallOps::RECV_MESSAGE => nil,
|
138
|
-
CallOps::
|
172
|
+
CallOps::RECV_CLOSE_ON_SERVER => nil,
|
173
|
+
CallOps::SEND_MESSAGE => long_response_str,
|
174
|
+
CallOps::SEND_STATUS_FROM_SERVER => ok_status
|
139
175
|
}
|
140
|
-
|
141
|
-
expect(
|
142
|
-
expect(
|
176
|
+
server_batch = server_call.run_batch(server_ops)
|
177
|
+
expect(server_batch.message).to eq(long_request_str)
|
178
|
+
expect(server_batch.send_close).to be true
|
179
|
+
expect(server_batch.send_message).to be true
|
180
|
+
expect(server_batch.send_status).to be true
|
143
181
|
|
144
182
|
client_ops = {
|
145
|
-
CallOps::SEND_CLOSE_FROM_CLIENT => nil,
|
146
183
|
CallOps::RECV_INITIAL_METADATA => nil,
|
147
|
-
CallOps::RECV_MESSAGE => nil
|
184
|
+
CallOps::RECV_MESSAGE => nil,
|
185
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil
|
148
186
|
}
|
149
|
-
|
150
|
-
expect(
|
151
|
-
expect(
|
187
|
+
final_client_batch = call.run_batch(client_ops)
|
188
|
+
expect(final_client_batch.metadata).to eq({})
|
189
|
+
expect(final_client_batch.message).to eq long_response_str
|
190
|
+
expect(final_client_batch.status.code).to eq(0)
|
152
191
|
end
|
153
192
|
|
154
193
|
it 'servers can ignore a client write and send a status' do
|
@@ -161,11 +200,13 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
161
200
|
|
162
201
|
client_ops = {
|
163
202
|
CallOps::SEND_INITIAL_METADATA => {},
|
164
|
-
CallOps::SEND_MESSAGE => sent_message
|
203
|
+
CallOps::SEND_MESSAGE => sent_message,
|
204
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
165
205
|
}
|
166
|
-
|
167
|
-
expect(
|
168
|
-
expect(
|
206
|
+
client_batch = call.run_batch(client_ops)
|
207
|
+
expect(client_batch.send_metadata).to be true
|
208
|
+
expect(client_batch.send_message).to be true
|
209
|
+
expect(client_batch.send_close).to be true
|
169
210
|
|
170
211
|
# confirm the server can read the inbound message
|
171
212
|
the_status = Struct::Status.new(StatusCodes::OK, 'OK')
|
@@ -173,9 +214,15 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
173
214
|
server_ops = {
|
174
215
|
CallOps::SEND_STATUS_FROM_SERVER => the_status
|
175
216
|
}
|
176
|
-
|
177
|
-
expect(
|
178
|
-
expect(
|
217
|
+
server_batch = server_call.run_batch(server_ops)
|
218
|
+
expect(server_batch.message).to eq nil
|
219
|
+
expect(server_batch.send_status).to be true
|
220
|
+
|
221
|
+
final_client_batch = call.run_batch(
|
222
|
+
CallOps::RECV_INITIAL_METADATA => nil,
|
223
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil)
|
224
|
+
expect(final_client_batch.metadata).to eq({})
|
225
|
+
expect(final_client_batch.status.code).to eq(0)
|
179
226
|
end
|
180
227
|
|
181
228
|
it 'completes calls by sending status to client and server' do
|
@@ -190,9 +237,9 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
190
237
|
CallOps::SEND_INITIAL_METADATA => {},
|
191
238
|
CallOps::SEND_MESSAGE => sent_message
|
192
239
|
}
|
193
|
-
|
194
|
-
expect(
|
195
|
-
expect(
|
240
|
+
client_batch = call.run_batch(client_ops)
|
241
|
+
expect(client_batch.send_metadata).to be true
|
242
|
+
expect(client_batch.send_message).to be true
|
196
243
|
|
197
244
|
# confirm the server can read the inbound message and respond
|
198
245
|
the_status = Struct::Status.new(StatusCodes::OK, 'OK', {})
|
@@ -202,10 +249,10 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
202
249
|
CallOps::SEND_MESSAGE => reply_text,
|
203
250
|
CallOps::SEND_STATUS_FROM_SERVER => the_status
|
204
251
|
}
|
205
|
-
|
206
|
-
expect(
|
207
|
-
expect(
|
208
|
-
expect(
|
252
|
+
server_batch = server_call.run_batch(server_ops)
|
253
|
+
expect(server_batch.message).to eq sent_message
|
254
|
+
expect(server_batch.send_status).to be true
|
255
|
+
expect(server_batch.send_message).to be true
|
209
256
|
|
210
257
|
# confirm the client can receive the server response and status.
|
211
258
|
client_ops = {
|
@@ -214,17 +261,17 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
214
261
|
CallOps::RECV_MESSAGE => nil,
|
215
262
|
CallOps::RECV_STATUS_ON_CLIENT => nil
|
216
263
|
}
|
217
|
-
|
218
|
-
expect(
|
219
|
-
expect(
|
220
|
-
expect(
|
264
|
+
final_client_batch = call.run_batch(client_ops)
|
265
|
+
expect(final_client_batch.send_close).to be true
|
266
|
+
expect(final_client_batch.message).to eq reply_text
|
267
|
+
expect(final_client_batch.status).to eq the_status
|
221
268
|
|
222
269
|
# confirm the server can receive the client close.
|
223
270
|
server_ops = {
|
224
271
|
CallOps::RECV_CLOSE_ON_SERVER => nil
|
225
272
|
}
|
226
|
-
|
227
|
-
expect(
|
273
|
+
final_server_batch = server_call.run_batch(server_ops)
|
274
|
+
expect(final_server_batch.send_close).to be true
|
228
275
|
end
|
229
276
|
|
230
277
|
def client_cancel_test(cancel_proc, expected_code,
|
@@ -240,9 +287,9 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
240
287
|
CallOps::SEND_INITIAL_METADATA => {},
|
241
288
|
CallOps::RECV_INITIAL_METADATA => nil
|
242
289
|
}
|
243
|
-
|
244
|
-
expect(
|
245
|
-
expect(
|
290
|
+
client_batch = call.run_batch(client_ops)
|
291
|
+
expect(client_batch.send_metadata).to be true
|
292
|
+
expect(client_batch.metadata).to eq({})
|
246
293
|
|
247
294
|
cancel_proc.call(call)
|
248
295
|
|
@@ -250,16 +297,16 @@ shared_examples 'basic GRPC message delivery is OK' do
|
|
250
297
|
server_ops = {
|
251
298
|
CallOps::RECV_CLOSE_ON_SERVER => nil
|
252
299
|
}
|
253
|
-
|
254
|
-
expect(
|
300
|
+
server_batch = server_call.run_batch(server_ops)
|
301
|
+
expect(server_batch.send_close).to be true
|
255
302
|
|
256
303
|
client_ops = {
|
257
304
|
CallOps::RECV_STATUS_ON_CLIENT => {}
|
258
305
|
}
|
259
|
-
|
306
|
+
client_batch = call.run_batch(client_ops)
|
260
307
|
|
261
|
-
expect(
|
262
|
-
expect(
|
308
|
+
expect(client_batch.status.code).to be expected_code
|
309
|
+
expect(client_batch.status.details).to eq expected_details
|
263
310
|
end
|
264
311
|
|
265
312
|
it 'clients can cancel a call on the server' do
|
@@ -325,10 +372,11 @@ shared_examples 'GRPC metadata delivery works OK' do
|
|
325
372
|
|
326
373
|
call = new_client_call
|
327
374
|
client_ops = {
|
328
|
-
CallOps::SEND_INITIAL_METADATA => md
|
375
|
+
CallOps::SEND_INITIAL_METADATA => md,
|
376
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
329
377
|
}
|
330
|
-
|
331
|
-
expect(
|
378
|
+
client_batch = call.run_batch(client_ops)
|
379
|
+
expect(client_batch.send_metadata).to be true
|
332
380
|
|
333
381
|
# confirm the server can receive the client metadata
|
334
382
|
rcv_thread.join
|
@@ -336,6 +384,21 @@ shared_examples 'GRPC metadata delivery works OK' do
|
|
336
384
|
recvd_md = recvd_rpc.metadata
|
337
385
|
replace_symbols = Hash[md.each_pair.collect { |x, y| [x.to_s, y] }]
|
338
386
|
expect(recvd_md).to eq(recvd_md.merge(replace_symbols))
|
387
|
+
|
388
|
+
# finish the call
|
389
|
+
final_server_batch = recvd_rpc.call.run_batch(
|
390
|
+
CallOps::RECV_CLOSE_ON_SERVER => nil,
|
391
|
+
CallOps::SEND_INITIAL_METADATA => nil,
|
392
|
+
CallOps::SEND_STATUS_FROM_SERVER => ok_status)
|
393
|
+
expect(final_server_batch.send_close).to be(true)
|
394
|
+
expect(final_server_batch.send_metadata).to be(true)
|
395
|
+
expect(final_server_batch.send_status).to be(true)
|
396
|
+
|
397
|
+
final_client_batch = call.run_batch(
|
398
|
+
CallOps::RECV_INITIAL_METADATA => nil,
|
399
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil)
|
400
|
+
expect(final_client_batch.metadata).to eq({})
|
401
|
+
expect(final_client_batch.status.code).to eq(0)
|
339
402
|
end
|
340
403
|
end
|
341
404
|
end
|
@@ -381,6 +444,9 @@ shared_examples 'GRPC metadata delivery works OK' do
|
|
381
444
|
recvd_rpc.call.run_batch(server_ops)
|
382
445
|
end
|
383
446
|
expect(&blk).to raise_error
|
447
|
+
|
448
|
+
# cancel the call so the server can shut down immediately
|
449
|
+
call.cancel
|
384
450
|
end
|
385
451
|
end
|
386
452
|
|
@@ -394,25 +460,37 @@ shared_examples 'GRPC metadata delivery works OK' do
|
|
394
460
|
# client signals that it's done sending metadata to allow server to
|
395
461
|
# respond
|
396
462
|
client_ops = {
|
397
|
-
CallOps::SEND_INITIAL_METADATA => nil
|
463
|
+
CallOps::SEND_INITIAL_METADATA => nil,
|
464
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
398
465
|
}
|
399
|
-
call.run_batch(client_ops)
|
466
|
+
client_batch = call.run_batch(client_ops)
|
467
|
+
expect(client_batch.send_metadata).to be true
|
468
|
+
expect(client_batch.send_close).to be true
|
400
469
|
|
401
470
|
# server gets the invocation but sends no metadata back
|
402
471
|
rcv_thread.join
|
403
472
|
expect(recvd_rpc).to_not eq nil
|
404
473
|
server_call = recvd_rpc.call
|
405
474
|
server_ops = {
|
406
|
-
|
475
|
+
# receive close and send status to finish the call
|
476
|
+
CallOps::RECV_CLOSE_ON_SERVER => nil,
|
477
|
+
CallOps::SEND_INITIAL_METADATA => nil,
|
478
|
+
CallOps::SEND_STATUS_FROM_SERVER => ok_status
|
407
479
|
}
|
408
|
-
server_call.run_batch(server_ops)
|
480
|
+
srv_batch = server_call.run_batch(server_ops)
|
481
|
+
expect(srv_batch.send_close).to be true
|
482
|
+
expect(srv_batch.send_metadata).to be true
|
483
|
+
expect(srv_batch.send_status).to be true
|
409
484
|
|
410
485
|
# client receives nothing as expected
|
411
486
|
client_ops = {
|
412
|
-
CallOps::RECV_INITIAL_METADATA => nil
|
487
|
+
CallOps::RECV_INITIAL_METADATA => nil,
|
488
|
+
# receive status to finish the call
|
489
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil
|
413
490
|
}
|
414
|
-
|
415
|
-
expect(
|
491
|
+
final_client_batch = call.run_batch(client_ops)
|
492
|
+
expect(final_client_batch.metadata).to eq({})
|
493
|
+
expect(final_client_batch.status.code).to eq(0)
|
416
494
|
end
|
417
495
|
|
418
496
|
it 'sends all the pairs when keys and values are valid' do
|
@@ -426,26 +504,36 @@ shared_examples 'GRPC metadata delivery works OK' do
|
|
426
504
|
# client signals that it's done sending metadata to allow server to
|
427
505
|
# respond
|
428
506
|
client_ops = {
|
429
|
-
CallOps::SEND_INITIAL_METADATA => nil
|
507
|
+
CallOps::SEND_INITIAL_METADATA => nil,
|
508
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil
|
430
509
|
}
|
431
|
-
call.run_batch(client_ops)
|
510
|
+
client_batch = call.run_batch(client_ops)
|
511
|
+
expect(client_batch.send_metadata).to be true
|
512
|
+
expect(client_batch.send_close).to be true
|
432
513
|
|
433
514
|
# server gets the invocation but sends no metadata back
|
434
515
|
rcv_thread.join
|
435
516
|
expect(recvd_rpc).to_not eq nil
|
436
517
|
server_call = recvd_rpc.call
|
437
518
|
server_ops = {
|
438
|
-
CallOps::
|
519
|
+
CallOps::RECV_CLOSE_ON_SERVER => nil,
|
520
|
+
CallOps::SEND_INITIAL_METADATA => md,
|
521
|
+
CallOps::SEND_STATUS_FROM_SERVER => ok_status
|
439
522
|
}
|
440
|
-
server_call.run_batch(server_ops)
|
523
|
+
srv_batch = server_call.run_batch(server_ops)
|
524
|
+
expect(srv_batch.send_close).to be true
|
525
|
+
expect(srv_batch.send_metadata).to be true
|
526
|
+
expect(srv_batch.send_status).to be true
|
441
527
|
|
442
528
|
# client receives nothing as expected
|
443
529
|
client_ops = {
|
444
|
-
CallOps::RECV_INITIAL_METADATA => nil
|
530
|
+
CallOps::RECV_INITIAL_METADATA => nil,
|
531
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil
|
445
532
|
}
|
446
|
-
|
533
|
+
final_client_batch = call.run_batch(client_ops)
|
447
534
|
replace_symbols = Hash[md.each_pair.collect { |x, y| [x.to_s, y] }]
|
448
|
-
expect(
|
535
|
+
expect(final_client_batch.metadata).to eq(replace_symbols)
|
536
|
+
expect(final_client_batch.status.code).to eq(0)
|
449
537
|
end
|
450
538
|
end
|
451
539
|
end
|
@@ -510,8 +598,7 @@ describe 'the secure http client/server' do
|
|
510
598
|
|
511
599
|
initial_md_key = 'k2'
|
512
600
|
initial_md_val = 'v2'
|
513
|
-
initial_md = {}
|
514
|
-
initial_md[initial_md_key] = initial_md_val
|
601
|
+
initial_md = { initial_md_key => initial_md_val }
|
515
602
|
expected_md = creds_update_md.clone
|
516
603
|
fail 'bad test param' unless expected_md[initial_md_key].nil?
|
517
604
|
expected_md[initial_md_key] = initial_md_val
|
@@ -523,11 +610,12 @@ describe 'the secure http client/server' do
|
|
523
610
|
|
524
611
|
call = new_client_call
|
525
612
|
call.set_credentials! call_creds
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
expect(
|
613
|
+
|
614
|
+
client_batch = call.run_batch(
|
615
|
+
CallOps::SEND_INITIAL_METADATA => initial_md,
|
616
|
+
CallOps::SEND_CLOSE_FROM_CLIENT => nil)
|
617
|
+
expect(client_batch.send_metadata).to be true
|
618
|
+
expect(client_batch.send_close).to be true
|
531
619
|
|
532
620
|
# confirm the server can receive the client metadata
|
533
621
|
rcv_thread.join
|
@@ -535,6 +623,24 @@ describe 'the secure http client/server' do
|
|
535
623
|
recvd_md = recvd_rpc.metadata
|
536
624
|
replace_symbols = Hash[expected_md.each_pair.collect { |x, y| [x.to_s, y] }]
|
537
625
|
expect(recvd_md).to eq(recvd_md.merge(replace_symbols))
|
626
|
+
|
627
|
+
credentials_update_test_finish_call(call, recvd_rpc.call)
|
628
|
+
end
|
629
|
+
|
630
|
+
def credentials_update_test_finish_call(client_call, server_call)
|
631
|
+
final_server_batch = server_call.run_batch(
|
632
|
+
CallOps::RECV_CLOSE_ON_SERVER => nil,
|
633
|
+
CallOps::SEND_INITIAL_METADATA => nil,
|
634
|
+
CallOps::SEND_STATUS_FROM_SERVER => ok_status)
|
635
|
+
expect(final_server_batch.send_close).to be(true)
|
636
|
+
expect(final_server_batch.send_metadata).to be(true)
|
637
|
+
expect(final_server_batch.send_status).to be(true)
|
638
|
+
|
639
|
+
final_client_batch = client_call.run_batch(
|
640
|
+
CallOps::RECV_INITIAL_METADATA => nil,
|
641
|
+
CallOps::RECV_STATUS_ON_CLIENT => nil)
|
642
|
+
expect(final_client_batch.metadata).to eq({})
|
643
|
+
expect(final_client_batch.status.code).to eq(0)
|
538
644
|
end
|
539
645
|
|
540
646
|
it 'modifies metadata with CallCredentials' do
|