Test that a blocked entrust causes a retry

This commit is contained in:
Alex Young
2012-07-03 18:00:31 +01:00
parent 061512f3dc
commit 17fe6d3023
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# encoding: utf-8
# Open a server, accept a client, then we expect a single write
# followed by an entrust. However, we disconnect after the write so
# the entrust will fail. We expect a reconnection.
require 'flexnbd/fake_dest'
include FlexNBD
addr, port, src_pid = *ARGV
server = FakeDest.new( addr, port )
client = server.accept
client.write_hello
req = client.read_request
data = client.read_data( req[:len] )
Process.kill("STOP", src_pid.to_i)
client.write_reply( req[:handle], 0 )
client.close
Process.kill("CONT", src_pid.to_i)
client2 = server.accept
client2.close
exit(0)

View File

@@ -96,6 +96,13 @@ class TestSourceErrorHandling < Test::Unit::TestCase
end
def test_pre_entrust_disconnect_causes_retry
run_fake( "dest/close_after_writes" )
@env.mirror12_unchecked
assert_success
end
private
def run_fake(name)
@env.run_fake( name, @env.ip, @env.port2 )