Files
flexnbd-c/tests/acceptance/fakes/dest/hello_wrong_magic.rb

29 lines
560 B
Ruby
Raw Normal View History

2012-06-22 10:05:41 +01:00
#!/usr/bin/env ruby
# Simulate a destination which sends the wrong magic.
require 'flexnbd/fake_dest'
include FlexNBD
Thread.abort_on_exception
2012-06-22 10:05:41 +01:00
addr, port = *ARGV
2018-02-02 21:34:14 +00:00
server = FakeDest.new(addr, port)
client1 = server.accept
2012-06-22 10:05:41 +01:00
# We don't expect a reconnection attempt.
2012-06-22 10:05:41 +01:00
t = Thread.new do
begin
2018-02-02 21:34:14 +00:00
client2 = server.accept('Timed out waiting for a reconnection',
FlexNBD::MS_RETRY_DELAY_SECS + 1)
raise 'Unexpected reconnection'
rescue Timeout::Error
2018-02-02 21:34:14 +00:00
# expected
end
2012-06-22 10:05:41 +01:00
end
2018-02-02 21:34:14 +00:00
client1.write_hello(magic: :wrong)
2012-06-22 10:05:41 +01:00
t.join
exit 0