Refactor FakeSource from a module to a class
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# Connect to the destination, then hang. Connect a second time to the
|
||||
# destination. This will trigger the destination's thread clearer.
|
||||
# destination. This will trigger the destination's thread clearer. We
|
||||
# can't really see any error state from here, we just try to trigger
|
||||
# something the test runner can detect.
|
||||
|
||||
require 'flexnbd/fake_source'
|
||||
include FlexNBD::FakeSource
|
||||
include FlexNBD
|
||||
|
||||
addr, port = *ARGV
|
||||
|
||||
# client_sock1 is a connection the destination is expecting.
|
||||
client_sock1 = connect( addr, port, "Timed out connecting" )
|
||||
client1 = FakeSource.new( addr, port, "Timed out connecting" )
|
||||
sleep(0.25)
|
||||
client_sock2 = connect( addr, port, "Timed out connecting a second time" )
|
||||
client2 = FakeSource.new( addr, port, "Timed out connecting a second time" )
|
||||
|
||||
# This is the expected source crashing after connect
|
||||
client_sock1.close
|
||||
client1.close
|
||||
# And this is just a tidy-up.
|
||||
client_sock2.close
|
||||
client2.close
|
||||
|
||||
exit(0)
|
||||
|
Reference in New Issue
Block a user