grpc 0.13.1-x86-mingw32 → 0.14.1.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/extconf.rb +14 -20
- data/src/ruby/ext/grpc/rb_byte_buffer.c +2 -3
- data/src/ruby/ext/grpc/rb_call.c +37 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +13 -3
- data/src/ruby/ext/grpc/rb_channel.c +2 -3
- data/src/ruby/ext/grpc/rb_channel_args.c +2 -3
- data/src/ruby/ext/grpc/rb_channel_credentials.c +31 -3
- data/src/ruby/ext/grpc/rb_completion_queue.c +2 -2
- data/src/ruby/ext/grpc/rb_event_thread.c +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +4 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +8 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +14 -2
- data/src/ruby/ext/grpc/rb_server.c +2 -3
- data/src/ruby/ext/grpc/rb_server_credentials.c +16 -13
- data/src/ruby/ext/grpc/rb_signal.c +70 -0
- data/src/ruby/ext/grpc/rb_signal.h +39 -0
- data/src/ruby/lib/grpc.rb +21 -13
- 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/core/time_consts.rb +2 -2
- data/src/ruby/lib/grpc/errors.rb +2 -2
- data/src/ruby/lib/grpc/generic/active_call.rb +10 -3
- data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -2
- data/src/ruby/lib/grpc/generic/client_stub.rb +10 -7
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +2 -2
- data/src/ruby/lib/grpc/generic/rpc_server.rb +21 -61
- data/src/ruby/lib/grpc/generic/service.rb +5 -15
- data/src/ruby/lib/grpc/grpc.rb +3 -3
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/{bin/interop/interop_client.rb → lib/grpc/signals.rb} +39 -21
- data/src/ruby/lib/grpc/version.rb +2 -2
- data/src/ruby/pb/generate_proto_ruby.sh +9 -2
- data/src/ruby/pb/grpc/health/checker.rb +1 -1
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services.rb +28 -0
- data/src/ruby/pb/grpc/testing/metrics.rb +28 -0
- data/src/ruby/pb/grpc/testing/metrics_services.rb +27 -0
- data/src/ruby/pb/test/client.rb +12 -23
- data/src/ruby/pb/test/server.rb +1 -1
- data/src/ruby/spec/client_server_spec.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +18 -17
- data/src/ruby/spec/generic/rpc_server_spec.rb +23 -7
- data/src/ruby/spec/generic/service_spec.rb +0 -69
- data/src/ruby/{bin/interop/interop_server.rb → spec/pb/duplicate/codegen_spec.rb} +41 -20
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- metadata +27 -15
- data/src/ruby/bin/grpc_ruby_interop_client +0 -33
- data/src/ruby/bin/grpc_ruby_interop_server +0 -33
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2015
|
1
|
+
# Copyright 2015, Google Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -27,47 +27,14 @@
|
|
27
27
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
28
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
require_relative '../grpc'
|
31
|
+
require_relative '../signals'
|
32
|
+
require_relative 'active_call'
|
33
|
+
require_relative 'service'
|
33
34
|
require 'thread'
|
34
35
|
|
35
|
-
# A global that contains signals the gRPC servers should respond to.
|
36
|
-
$grpc_signals = []
|
37
|
-
|
38
36
|
# GRPC contains the General RPC module.
|
39
37
|
module GRPC
|
40
|
-
# Handles the signals in $grpc_signals.
|
41
|
-
#
|
42
|
-
# @return false if the server should exit, true if not.
|
43
|
-
def handle_signals
|
44
|
-
loop do
|
45
|
-
sig = $grpc_signals.shift
|
46
|
-
case sig
|
47
|
-
when 'INT'
|
48
|
-
return false
|
49
|
-
when 'TERM'
|
50
|
-
return false
|
51
|
-
when nil
|
52
|
-
return true
|
53
|
-
end
|
54
|
-
end
|
55
|
-
true
|
56
|
-
end
|
57
|
-
module_function :handle_signals
|
58
|
-
|
59
|
-
# Sets up a signal handler that adds signals to the signal handling global.
|
60
|
-
#
|
61
|
-
# Signal handlers should do as little as humanly possible.
|
62
|
-
# Here, they just add themselves to $grpc_signals
|
63
|
-
#
|
64
|
-
# RpcServer (and later other parts of gRPC) monitors the signals
|
65
|
-
# $grpc_signals in its own non-signal context.
|
66
|
-
def trap_signals
|
67
|
-
%w(INT TERM).each { |sig| trap(sig) { $grpc_signals << sig } }
|
68
|
-
end
|
69
|
-
module_function :trap_signals
|
70
|
-
|
71
38
|
# Pool is a simple thread pool.
|
72
39
|
class Pool
|
73
40
|
# Default keep alive period is 1s
|
@@ -328,20 +295,6 @@ module GRPC
|
|
328
295
|
end
|
329
296
|
end
|
330
297
|
|
331
|
-
# Runs the server in its own thread, then waits for signal INT or TERM on
|
332
|
-
# the current thread to terminate it.
|
333
|
-
def run_till_terminated
|
334
|
-
GRPC.trap_signals
|
335
|
-
t = Thread.new { run }
|
336
|
-
wait_till_running
|
337
|
-
loop do
|
338
|
-
sleep SIGNAL_CHECK_PERIOD
|
339
|
-
break unless GRPC.handle_signals
|
340
|
-
end
|
341
|
-
stop
|
342
|
-
t.join
|
343
|
-
end
|
344
|
-
|
345
298
|
# handle registration of classes
|
346
299
|
#
|
347
300
|
# service is either a class that includes GRPC::GenericService and whose
|
@@ -400,10 +353,15 @@ module GRPC
|
|
400
353
|
transition_running_state(:running)
|
401
354
|
@run_cond.broadcast
|
402
355
|
end
|
356
|
+
remove_signal_handler = GRPC::Signals.register_handler { stop }
|
403
357
|
loop_handle_server_calls
|
358
|
+
# Remove signal handler when server stops
|
359
|
+
remove_signal_handler.call
|
404
360
|
end
|
405
361
|
|
406
|
-
|
362
|
+
alias_method :run_till_terminated, :run
|
363
|
+
|
364
|
+
# Sends RESOURCE_EXHAUSTED if there are too many unprocessed jobs
|
407
365
|
def available?(an_rpc)
|
408
366
|
jobs_count, max = @pool.jobs_waiting, @max_waiting_requests
|
409
367
|
GRPC.logger.info("waiting: #{jobs_count}, max: #{max}")
|
@@ -411,7 +369,7 @@ module GRPC
|
|
411
369
|
GRPC.logger.warn("NOT AVAILABLE: too many jobs_waiting: #{an_rpc}")
|
412
370
|
noop = proc { |x| x }
|
413
371
|
c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline)
|
414
|
-
c.send_status(StatusCodes::
|
372
|
+
c.send_status(GRPC::Core::StatusCodes::RESOURCE_EXHAUSTED, '')
|
415
373
|
nil
|
416
374
|
end
|
417
375
|
|
@@ -422,7 +380,7 @@ module GRPC
|
|
422
380
|
GRPC.logger.warn("UNIMPLEMENTED: #{an_rpc}")
|
423
381
|
noop = proc { |x| x }
|
424
382
|
c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline)
|
425
|
-
c.send_status(StatusCodes::UNIMPLEMENTED, '')
|
383
|
+
c.send_status(GRPC::Core::StatusCodes::UNIMPLEMENTED, '')
|
426
384
|
nil
|
427
385
|
end
|
428
386
|
|
@@ -434,12 +392,16 @@ module GRPC
|
|
434
392
|
begin
|
435
393
|
an_rpc = @server.request_call(@cq, loop_tag, INFINITE_FUTURE)
|
436
394
|
break if (!an_rpc.nil?) && an_rpc.call.nil?
|
437
|
-
|
438
395
|
active_call = new_active_server_call(an_rpc)
|
439
396
|
unless active_call.nil?
|
440
397
|
@pool.schedule(active_call) do |ac|
|
441
398
|
c, mth = ac
|
442
|
-
|
399
|
+
begin
|
400
|
+
rpc_descs[mth].run_server_method(c, rpc_handlers[mth])
|
401
|
+
rescue StandardError
|
402
|
+
c.send_status(GRPC::Core::StatusCodes::INTERNAL,
|
403
|
+
'Server handler failed')
|
404
|
+
end
|
443
405
|
end
|
444
406
|
end
|
445
407
|
rescue Core::CallError, RuntimeError => e
|
@@ -496,10 +458,8 @@ module GRPC
|
|
496
458
|
unless cls.include?(GenericService)
|
497
459
|
fail "#{cls} must 'include GenericService'"
|
498
460
|
end
|
499
|
-
|
500
|
-
|
501
|
-
end
|
502
|
-
cls.assert_rpc_descs_have_methods
|
461
|
+
fail "#{cls} should specify some rpc descriptions" if
|
462
|
+
cls.rpc_descs.size.zero?
|
503
463
|
end
|
504
464
|
|
505
465
|
# This should be called while holding @run_mutex
|
@@ -27,8 +27,8 @@
|
|
27
27
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
28
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
require_relative 'client_stub'
|
31
|
+
require_relative 'rpc_desc'
|
32
32
|
|
33
33
|
# GRPC contains the General RPC module.
|
34
34
|
module GRPC
|
@@ -110,6 +110,9 @@ module GRPC
|
|
110
110
|
rpc_descs[name] = RpcDesc.new(name, input, output,
|
111
111
|
marshal_class_method,
|
112
112
|
unmarshal_class_method)
|
113
|
+
define_method(name) do
|
114
|
+
fail GRPC::BadStatus, GRPC::Core::StatusCodes::UNIMPLEMENTED
|
115
|
+
end
|
113
116
|
end
|
114
117
|
|
115
118
|
def inherited(subclass)
|
@@ -199,19 +202,6 @@ module GRPC
|
|
199
202
|
end
|
200
203
|
end
|
201
204
|
end
|
202
|
-
|
203
|
-
# Asserts that the appropriate methods are defined for each added rpc
|
204
|
-
# spec. Is intended to aid verifying that server classes are correctly
|
205
|
-
# implemented.
|
206
|
-
def assert_rpc_descs_have_methods
|
207
|
-
rpc_descs.each_pair do |m, spec|
|
208
|
-
mth_name = GenericService.underscore(m.to_s).to_sym
|
209
|
-
unless instance_methods.include?(mth_name)
|
210
|
-
fail "#{self} does not provide instance method '#{mth_name}'"
|
211
|
-
end
|
212
|
-
spec.assert_arity_matches(instance_method(mth_name))
|
213
|
-
end
|
214
|
-
end
|
215
205
|
end
|
216
206
|
|
217
207
|
def self.included(o)
|
data/src/ruby/lib/grpc/grpc.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2015
|
1
|
+
# Copyright 2015, Google Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -28,7 +28,7 @@
|
|
28
28
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
29
|
|
30
30
|
begin
|
31
|
-
|
31
|
+
require_relative "#{RUBY_VERSION.sub(/\.\d$/, '')}/grpc_c"
|
32
32
|
rescue LoadError
|
33
|
-
|
33
|
+
require_relative 'grpc_c'
|
34
34
|
end
|
data/src/ruby/lib/grpc/grpc_c.so
CHANGED
Binary file
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# Copyright 2015, Google Inc.
|
1
|
+
# Copyright 2016, Google Inc.
|
4
2
|
# All rights reserved.
|
5
3
|
#
|
6
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -29,23 +27,43 @@
|
|
29
27
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
28
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
#
|
36
|
-
|
37
|
-
#
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
#
|
43
|
-
# Usage: $ path/to/interop_client.rb --server_host=<hostname> \
|
44
|
-
# --server_port=<port> \
|
45
|
-
# --test_case=<testcase_name>
|
30
|
+
require 'thread'
|
31
|
+
require_relative 'grpc'
|
32
|
+
|
33
|
+
# GRPC contains the General RPC module.
|
34
|
+
module GRPC
|
35
|
+
# Signals contains gRPC functions related to signal handling
|
36
|
+
module Signals
|
37
|
+
@interpreter_exiting = false
|
38
|
+
@signal_handlers = []
|
39
|
+
@handlers_mutex = Mutex.new
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
def register_handler(&handler)
|
42
|
+
@handlers_mutex.synchronize do
|
43
|
+
@signal_handlers.push(handler)
|
44
|
+
handler.call if @exit_signal_received
|
45
|
+
end
|
46
|
+
# Returns a function to remove the handler
|
47
|
+
lambda do
|
48
|
+
@handlers_mutex.synchronize { @signal_handlers.delete(handler) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
module_function :register_handler
|
50
52
|
|
51
|
-
|
53
|
+
def wait_for_signals
|
54
|
+
t = Thread.new do
|
55
|
+
sleep 0.1 until GRPC::Core.signal_received? || @interpreter_exiting
|
56
|
+
unless @interpreter_exiting
|
57
|
+
@handlers_mutex.synchronize do
|
58
|
+
@signal_handlers.each(&:call)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
at_exit do
|
63
|
+
@interpreter_exiting = true
|
64
|
+
t.join
|
65
|
+
end
|
66
|
+
end
|
67
|
+
module_function :wait_for_signals
|
68
|
+
end
|
69
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2015
|
1
|
+
# Copyright 2015, Google Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -29,5 +29,5 @@
|
|
29
29
|
|
30
30
|
# GRPC contains the General RPC module.
|
31
31
|
module GRPC
|
32
|
-
VERSION = '0.
|
32
|
+
VERSION = '0.14.1.pre1'
|
33
33
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
# Copyright 2015
|
2
|
+
# Copyright 2015, Google Inc.
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without
|
@@ -40,11 +40,18 @@ $PROTOC -I src/proto src/proto/grpc/health/v1/health.proto \
|
|
40
40
|
--ruby_out=src/ruby/pb \
|
41
41
|
--plugin=$PLUGIN
|
42
42
|
|
43
|
-
$PROTOC -I .
|
43
|
+
$PROTOC -I . \
|
44
|
+
src/proto/grpc/testing/{messages,test,empty}.proto \
|
44
45
|
--grpc_out=src/ruby/pb \
|
45
46
|
--ruby_out=src/ruby/pb \
|
46
47
|
--plugin=$PLUGIN
|
47
48
|
|
49
|
+
$PROTOC -I . \
|
50
|
+
src/proto/grpc/testing/{messages,payloads,stats,services,control}.proto \
|
51
|
+
--grpc_out=src/ruby/qps \
|
52
|
+
--ruby_out=src/ruby/qps \
|
53
|
+
--plugin=$PLUGIN
|
54
|
+
|
48
55
|
$PROTOC -I src/proto/math src/proto/math/math.proto \
|
49
56
|
--grpc_out=src/ruby/bin \
|
50
57
|
--ruby_out=src/ruby/bin \
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: src/proto/grpc/testing/duplicate/echo_duplicate.proto for package 'grpc.testing.duplicate'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'src/proto/grpc/testing/duplicate/echo_duplicate'
|
6
|
+
|
7
|
+
module Grpc
|
8
|
+
module Testing
|
9
|
+
module Duplicate
|
10
|
+
module EchoTestService
|
11
|
+
|
12
|
+
# TODO: add proto service documentation here
|
13
|
+
class Service
|
14
|
+
|
15
|
+
include GRPC::GenericService
|
16
|
+
|
17
|
+
self.marshal_class_method = :encode
|
18
|
+
self.unmarshal_class_method = :decode
|
19
|
+
self.service_name = 'grpc.testing.duplicate.EchoTestService'
|
20
|
+
|
21
|
+
rpc :Echo, Grpc::Testing::EchoRequest, Grpc::Testing::EchoResponse
|
22
|
+
end
|
23
|
+
|
24
|
+
Stub = Service.rpc_stub_class
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: grpc/testing/metrics.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_message "grpc.testing.GaugeResponse" do
|
8
|
+
optional :name, :string, 1
|
9
|
+
oneof :value do
|
10
|
+
optional :long_value, :int64, 2
|
11
|
+
optional :double_value, :double, 3
|
12
|
+
optional :string_value, :string, 4
|
13
|
+
end
|
14
|
+
end
|
15
|
+
add_message "grpc.testing.GaugeRequest" do
|
16
|
+
optional :name, :string, 1
|
17
|
+
end
|
18
|
+
add_message "grpc.testing.EmptyMessage" do
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module Grpc
|
23
|
+
module Testing
|
24
|
+
GaugeResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GaugeResponse").msgclass
|
25
|
+
GaugeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.GaugeRequest").msgclass
|
26
|
+
EmptyMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.EmptyMessage").msgclass
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: grpc/testing/metrics.proto for package 'grpc.testing'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'grpc/testing/metrics'
|
6
|
+
|
7
|
+
module Grpc
|
8
|
+
module Testing
|
9
|
+
module MetricsService
|
10
|
+
|
11
|
+
# TODO: add proto service documentation here
|
12
|
+
class Service
|
13
|
+
|
14
|
+
include GRPC::GenericService
|
15
|
+
|
16
|
+
self.marshal_class_method = :encode
|
17
|
+
self.unmarshal_class_method = :decode
|
18
|
+
self.service_name = 'grpc.testing.MetricsService'
|
19
|
+
|
20
|
+
rpc :GetAllGauges, EmptyMessage, stream(GaugeResponse)
|
21
|
+
rpc :GetGauge, GaugeRequest, GaugeResponse
|
22
|
+
end
|
23
|
+
|
24
|
+
Stub = Service.rpc_stub_class
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/src/ruby/pb/test/client.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# Copyright 2015
|
3
|
+
# Copyright 2015, Google Inc.
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -38,23 +38,23 @@
|
|
38
38
|
# --server_port=<port> \
|
39
39
|
# --test_case=<testcase_name>
|
40
40
|
|
41
|
+
# These lines are required for the generated files to load grpc
|
41
42
|
this_dir = File.expand_path(File.dirname(__FILE__))
|
42
43
|
lib_dir = File.join(File.dirname(File.dirname(this_dir)), 'lib')
|
43
|
-
pb_dir = File.dirname(
|
44
|
+
pb_dir = File.dirname(this_dir)
|
44
45
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
45
46
|
$LOAD_PATH.unshift(pb_dir) unless $LOAD_PATH.include?(pb_dir)
|
46
|
-
$LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
|
47
47
|
|
48
48
|
require 'optparse'
|
49
49
|
require 'logger'
|
50
50
|
|
51
|
-
|
51
|
+
require_relative '../../lib/grpc'
|
52
52
|
require 'googleauth'
|
53
53
|
require 'google/protobuf'
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
require_relative 'proto/empty'
|
56
|
+
require_relative 'proto/messages'
|
57
|
+
require_relative 'proto/test_services'
|
58
58
|
|
59
59
|
AUTH_ENV = Google::Auth::CredentialsLoader::ENV_VAR
|
60
60
|
|
@@ -208,12 +208,10 @@ class NamedTests
|
|
208
208
|
def empty_unary
|
209
209
|
resp = @stub.empty_call(Empty.new)
|
210
210
|
assert('empty_unary: invalid response') { resp.is_a?(Empty) }
|
211
|
-
p 'OK: empty_unary'
|
212
211
|
end
|
213
212
|
|
214
213
|
def large_unary
|
215
214
|
perform_large_unary
|
216
|
-
p 'OK: large_unary'
|
217
215
|
end
|
218
216
|
|
219
217
|
def service_account_creds
|
@@ -230,7 +228,6 @@ class NamedTests
|
|
230
228
|
assert("#{__callee__}: bad oauth scope") do
|
231
229
|
@args.oauth_scope.include?(resp.oauth_scope)
|
232
230
|
end
|
233
|
-
p "OK: #{__callee__}"
|
234
231
|
end
|
235
232
|
|
236
233
|
def jwt_token_creds
|
@@ -238,7 +235,6 @@ class NamedTests
|
|
238
235
|
wanted_email = MultiJson.load(json_key)['client_email']
|
239
236
|
resp = perform_large_unary(fill_username: true)
|
240
237
|
assert("#{__callee__}: bad username") { wanted_email == resp.username }
|
241
|
-
p "OK: #{__callee__}"
|
242
238
|
end
|
243
239
|
|
244
240
|
def compute_engine_creds
|
@@ -247,7 +243,6 @@ class NamedTests
|
|
247
243
|
assert("#{__callee__}: bad username") do
|
248
244
|
@args.default_service_account == resp.username
|
249
245
|
end
|
250
|
-
p "OK: #{__callee__}"
|
251
246
|
end
|
252
247
|
|
253
248
|
def oauth2_auth_token
|
@@ -259,7 +254,6 @@ class NamedTests
|
|
259
254
|
assert("#{__callee__}: bad oauth scope") do
|
260
255
|
@args.oauth_scope.include?(resp.oauth_scope)
|
261
256
|
end
|
262
|
-
p "OK: #{__callee__}"
|
263
257
|
end
|
264
258
|
|
265
259
|
def per_rpc_creds
|
@@ -279,7 +273,6 @@ class NamedTests
|
|
279
273
|
assert("#{__callee__}: bad oauth scope") do
|
280
274
|
@args.oauth_scope.include?(resp.oauth_scope)
|
281
275
|
end
|
282
|
-
p "OK: #{__callee__}"
|
283
276
|
end
|
284
277
|
|
285
278
|
def client_streaming
|
@@ -293,7 +286,6 @@ class NamedTests
|
|
293
286
|
assert("#{__callee__}: aggregate payload size is incorrect") do
|
294
287
|
wanted_aggregate_size == resp.aggregated_payload_size
|
295
288
|
end
|
296
|
-
p "OK: #{__callee__}"
|
297
289
|
end
|
298
290
|
|
299
291
|
def server_streaming
|
@@ -311,7 +303,6 @@ class NamedTests
|
|
311
303
|
:COMPRESSABLE == r.payload.type
|
312
304
|
end
|
313
305
|
end
|
314
|
-
p "OK: #{__callee__}"
|
315
306
|
end
|
316
307
|
|
317
308
|
def ping_pong
|
@@ -319,7 +310,6 @@ class NamedTests
|
|
319
310
|
ppp = PingPongPlayer.new(msg_sizes)
|
320
311
|
resps = @stub.full_duplex_call(ppp.each_item)
|
321
312
|
resps.each { |r| ppp.queue.push(r) }
|
322
|
-
p "OK: #{__callee__}"
|
323
313
|
end
|
324
314
|
|
325
315
|
def timeout_on_sleeping_server
|
@@ -332,7 +322,6 @@ class NamedTests
|
|
332
322
|
assert("#{__callee__}: status was wrong") do
|
333
323
|
e.code == GRPC::Core::StatusCodes::DEADLINE_EXCEEDED
|
334
324
|
end
|
335
|
-
p "OK: #{__callee__}"
|
336
325
|
end
|
337
326
|
|
338
327
|
def empty_stream
|
@@ -346,7 +335,6 @@ class NamedTests
|
|
346
335
|
assert("#{__callee__}: too many responses expected 0") do
|
347
336
|
count == 0
|
348
337
|
end
|
349
|
-
p "OK: #{__callee__}"
|
350
338
|
end
|
351
339
|
|
352
340
|
def cancel_after_begin
|
@@ -361,7 +349,6 @@ class NamedTests
|
|
361
349
|
fail 'Should have raised GRPC:Cancelled'
|
362
350
|
rescue GRPC::Cancelled
|
363
351
|
assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled }
|
364
|
-
p "OK: #{__callee__}"
|
365
352
|
end
|
366
353
|
|
367
354
|
def cancel_after_first_response
|
@@ -374,7 +361,6 @@ class NamedTests
|
|
374
361
|
rescue GRPC::Cancelled
|
375
362
|
assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled }
|
376
363
|
op.wait
|
377
|
-
p "OK: #{__callee__}"
|
378
364
|
end
|
379
365
|
|
380
366
|
def all
|
@@ -442,7 +428,7 @@ def parse_args
|
|
442
428
|
opts.on('--use_tls USE_TLS', ['false', 'true'],
|
443
429
|
'require a secure connection?') do |v|
|
444
430
|
args['secure'] = v == 'true'
|
445
|
-
end
|
431
|
+
p end
|
446
432
|
opts.on('--use_test_ca USE_TEST_CA', ['false', 'true'],
|
447
433
|
'if secure, use the test certificate?') do |v|
|
448
434
|
args['use_test_ca'] = v == 'true'
|
@@ -464,6 +450,9 @@ def main
|
|
464
450
|
opts = parse_args
|
465
451
|
stub = create_stub(opts)
|
466
452
|
NamedTests.new(stub, opts).method(opts['test_case']).call
|
453
|
+
p "OK: #{opts['test_case']}"
|
467
454
|
end
|
468
455
|
|
469
|
-
|
456
|
+
if __FILE__ == $0
|
457
|
+
main
|
458
|
+
end
|