diff options
Diffstat (limited to 'actioncable/test')
-rw-r--r-- | actioncable/test/channel/stream_test.rb | 4 | ||||
-rw-r--r-- | actioncable/test/client_test.rb | 31 |
2 files changed, 30 insertions, 5 deletions
diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb index 31dcde2e29..50fc7be30b 100644 --- a/actioncable/test/channel/stream_test.rb +++ b/actioncable/test/channel/stream_test.rb @@ -55,6 +55,8 @@ module ActionCable::StreamTests channel = ChatChannel.new connection, "{id: 1}", id: 1 channel.subscribe_to_channel + wait_for_async + connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) } channel.unsubscribe_from_channel end @@ -67,6 +69,8 @@ module ActionCable::StreamTests channel = SymbolChannel.new connection, "" channel.subscribe_to_channel + wait_for_async + connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) } channel.unsubscribe_from_channel end diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb index 98a114a5f4..30ac1e9c38 100644 --- a/actioncable/test/client_test.rb +++ b/actioncable/test/client_test.rb @@ -68,12 +68,33 @@ class ClientTest < ActionCable::TestCase server.min_threads = 1 server.max_threads = 4 - t = Thread.new { server.run.join } - yield port + thread = server.run - ensure - server.stop(true) if server - t.join if t + begin + yield port + + ensure + server.stop + + begin + thread.join + + rescue IOError + # Work around https://bugs.ruby-lang.org/issues/13405 + # + # Puma's sometimes raising while shutting down, when it closes + # its internal pipe. We can safely ignore that, but we do need + # to do the step skipped by the exception: + server.binder.close + + rescue RuntimeError => ex + # Work around https://bugs.ruby-lang.org/issues/13239 + raise unless ex.message =~ /can't modify frozen IOError/ + + # Handle this as if it were the IOError: do the same as above. + server.binder.close + end + end end class SyncClient |