2012-07-12 09:39:39 +01:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2012-07-23 09:48:50 +01:00
|
|
|
# Connect, send a migration, entrust, read the reply, then disconnect.
|
2012-07-12 09:39:39 +01:00
|
|
|
# This simulates a client which fails while the client is blocked.
|
|
|
|
#
|
2012-07-23 09:48:50 +01:00
|
|
|
# We expect the destination to quit with an error status.
|
2012-07-12 09:39:39 +01:00
|
|
|
|
|
|
|
require 'flexnbd/fake_source'
|
|
|
|
include FlexNBD
|
|
|
|
|
2013-02-13 13:11:20 +00:00
|
|
|
addr, port, srv_pid = *ARGV
|
2012-07-12 09:39:39 +01:00
|
|
|
|
|
|
|
client = FakeSource.new( addr, port, "Timed out connecting" )
|
|
|
|
client.read_hello
|
|
|
|
client.write_write_request( 0, 8 )
|
|
|
|
client.write_data( "12345678" )
|
|
|
|
|
|
|
|
client.write_entrust_request
|
|
|
|
client.read_response
|
|
|
|
client.close
|
|
|
|
|
|
|
|
sleep(0.25)
|
|
|
|
|
|
|
|
|
2012-07-23 09:48:50 +01:00
|
|
|
begin
|
|
|
|
client2 = FakeSource.new( addr, port, "Expected timeout" )
|
|
|
|
fail "Unexpected reconnection"
|
|
|
|
rescue Timeout::Error
|
|
|
|
# expected
|
|
|
|
end
|
2012-07-12 09:39:39 +01:00
|
|
|
|
|
|
|
exit(0)
|
2013-02-13 13:11:20 +00:00
|
|
|
|