From f5850e5aaf6568a9344d6d192f711f1c1f23da72 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Sun, 15 Jul 2012 22:07:00 +0100 Subject: [PATCH] Switch from expecting a reconnection to *not* doing do If we're aborting mirror operations early, a couple of specs need to change sense. --- tests/acceptance/fakes/dest/hello_wrong_magic.rb | 16 +++++++++------- tests/acceptance/fakes/dest/reject_acl.rb | 10 ++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/acceptance/fakes/dest/hello_wrong_magic.rb b/tests/acceptance/fakes/dest/hello_wrong_magic.rb index 04349b8..ce2f98f 100755 --- a/tests/acceptance/fakes/dest/hello_wrong_magic.rb +++ b/tests/acceptance/fakes/dest/hello_wrong_magic.rb @@ -1,22 +1,24 @@ #!/usr/bin/env ruby # Simulate a destination which sends the wrong magic. -# We expect the sender to disconnect and reconnect. require 'flexnbd/fake_dest' include FlexNBD +Thread.abort_on_exception addr, port = *ARGV server = FakeDest.new( addr, port ) client1 = server.accept -# Launch a second thread so that we can spot the reconnection attempt -# as soon as it happens, or alternatively die a flaming death on -# timeout. +# We don't expect a reconnection attempt. t = Thread.new do - client2 = server.accept( "Timed out waiting for a reconnection", - FlexNBD::MS_RETRY_DELAY_SECS + 1 ) - client2.close + begin + client2 = server.accept( "Timed out waiting for a reconnection", + FlexNBD::MS_RETRY_DELAY_SECS + 1 ) + fail "Unexpected reconnection" + rescue Timeout::Error + #expected + end end client1.write_hello( :magic => :wrong ) diff --git a/tests/acceptance/fakes/dest/reject_acl.rb b/tests/acceptance/fakes/dest/reject_acl.rb index ab7e81b..b75c562 100755 --- a/tests/acceptance/fakes/dest/reject_acl.rb +++ b/tests/acceptance/fakes/dest/reject_acl.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby # Accept a connection, then immediately close it. This simulates an ACL rejection. +# We do not expect a reconnection. require 'flexnbd/fake_dest' include FlexNBD @@ -9,6 +10,15 @@ addr, port = *ARGV server = FakeDest.new( addr, port ) server.accept.close + +begin + server.accept + fail "Unexpected reconnection" +rescue Timeout::Error + # expected +end + server.close + exit(0)