Add test to check when proxy times-out mid-write to upstream

I've add to add code to allow the environment to specify the upstream
tiemout so we don't have to wait 30s for this test to happen.
This commit is contained in:
Patrick J Cherry
2018-11-14 16:49:55 +00:00
parent 3e00a88d45
commit b26b308e68
4 changed files with 88 additions and 3 deletions

View File

@@ -54,6 +54,10 @@ module FlexNBD
write_reply(handle, 1)
end
def nread
@sock.nread
end
def disconnected?
Timeout.timeout(2) do
@sock.read(1).nil?
@@ -85,6 +89,10 @@ module FlexNBD
@sock.write(len)
end
def getsockopt(level, optname)
@sock.getsockopt(level, optname)
end
def self.parse_be64(str)
raise "String is the wrong length: 8 bytes expected (#{str.length} received)" unless
str.length == 8