killed_client_thread_client.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env ruby
  2. # Copyright 2015 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Attempt to reproduce
  16. # https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues/1327
  17. require_relative './end2end_common'
  18. def main
  19. server_port = ''
  20. OptionParser.new do |opts|
  21. opts.on('--client_control_port=P', String) do
  22. STDERR.puts 'client control port not used'
  23. end
  24. opts.on('--server_port=P', String) do |p|
  25. server_port = p
  26. end
  27. end.parse!
  28. thd = Thread.new do
  29. stub = Echo::EchoServer::Stub.new("localhost:#{server_port}",
  30. :this_channel_is_insecure)
  31. stub.echo(Echo::EchoRequest.new(request: 'hello'))
  32. fail 'the clients rpc in this test shouldnt complete. ' \
  33. 'expecting SIGTERM to happen in the middle of the call'
  34. end
  35. thd.join
  36. end
  37. main