aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Alexander Polcyn <apolcyn@google.com>2017-04-16 10:26:44 -0700
committerGravatar Alexander Polcyn <apolcyn@google.com>2017-04-16 10:27:09 -0700
commitd1143abaa8ca7f52ca4fb0b56e24401d69dcea95 (patch)
tree7c1948869e14be2799d1a9d15d7de6670f89609f /src
parentc7fcebe75011567b3ac1a100cbacb82105c902b6 (diff)
tweak class init test to reveal bug in misordered startup
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ruby/end2end/grpc_class_init_client.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ruby/end2end/grpc_class_init_client.rb b/src/ruby/end2end/grpc_class_init_client.rb
index b321016b21..5fad1353be 100755
--- a/src/ruby/end2end/grpc_class_init_client.rb
+++ b/src/ruby/end2end/grpc_class_init_client.rb
@@ -29,7 +29,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Try to catch if native gRPC class constructors are missing a 'grpc_init'
+# For GRPC::Core classes, which use the grpc c-core, object init
+# is interesting because it's related to overall library init.
require_relative './end2end_common'
@@ -43,15 +44,35 @@ def main
case grpc_class
when 'channel'
+ thd = Thread.new do
+ GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure)
+ end
GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure)
+ thd.join
when 'server'
+ thd = Thread.new do
+ GRPC::Core::Server.new({})
+ end
GRPC::Core::Server.new({})
+ thd.join
when 'channel_credentials'
+ thd = Thread.new do
+ GRPC::Core::ChannelCredentials.new
+ end
GRPC::Core::ChannelCredentials.new
+ thd.join
when 'call_credentials'
+ thd = Thread.new do
+ GRPC::Core::CallCredentials.new(proc { |noop| noop })
+ end
GRPC::Core::CallCredentials.new(proc { |noop| noop })
+ thd.join
when 'compression_options'
+ thd = Thread.new do
+ GRPC::Core::CompressionOptions.new
+ end
GRPC::Core::CompressionOptions.new
+ thd.join
else
fail "bad --grpc_class=#{grpc_class} param"
end