Updated comments
This commit is contained in:
@@ -158,7 +158,7 @@ module ProxyTests
|
|||||||
# Send the read request to the proxy
|
# Send the read request to the proxy
|
||||||
client.write(0, (b * 4096))
|
client.write(0, (b * 4096))
|
||||||
|
|
||||||
# ensure we're given the read request
|
# ensure we're given the write request
|
||||||
req1 = sc1.read_request
|
req1 = sc1.read_request
|
||||||
assert_equal ::FlexNBD::REQUEST_MAGIC, req1[:magic]
|
assert_equal ::FlexNBD::REQUEST_MAGIC, req1[:magic]
|
||||||
assert_equal ::FlexNBD::REQUEST_WRITE, req1[:type]
|
assert_equal ::FlexNBD::REQUEST_WRITE, req1[:type]
|
||||||
@@ -221,15 +221,19 @@ module ProxyTests
|
|||||||
# Send the read request to the proxy
|
# Send the read request to the proxy
|
||||||
client.write(0, data1)
|
client.write(0, data1)
|
||||||
|
|
||||||
# ensure we're given the read request
|
# ensure we're given the write request
|
||||||
req1 = sc1.read_request
|
req1 = sc1.read_request
|
||||||
assert_equal ::FlexNBD::REQUEST_MAGIC, req1[:magic]
|
assert_equal ::FlexNBD::REQUEST_MAGIC, req1[:magic]
|
||||||
assert_equal ::FlexNBD::REQUEST_WRITE, req1[:type]
|
assert_equal ::FlexNBD::REQUEST_WRITE, req1[:type]
|
||||||
assert_equal 0, req1[:from]
|
assert_equal 0, req1[:from]
|
||||||
assert_equal data1.size, req1[:len]
|
assert_equal data1.size, req1[:len]
|
||||||
|
|
||||||
|
# We do not read it at this point, as we want the proxy to be waiting
|
||||||
|
# in the WRITE_UPSTREAM state.
|
||||||
|
|
||||||
# Need to sleep longer than the timeout set above
|
# Need to sleep longer than the timeout set above
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
# Check the number of bytes that can be read from the socket without
|
# Check the number of bytes that can be read from the socket without
|
||||||
# blocking. If this equal to the size of the original request, then
|
# blocking. If this equal to the size of the original request, then
|
||||||
# the whole request has been buffered. If this is the case, then the
|
# the whole request has been buffered. If this is the case, then the
|
||||||
@@ -237,7 +241,7 @@ module ProxyTests
|
|||||||
# we're trying to test.
|
# we're trying to test.
|
||||||
assert sc1.nread < sz, 'Request from proxy completely buffered. Test is useless'
|
assert sc1.nread < sz, 'Request from proxy completely buffered. Test is useless'
|
||||||
|
|
||||||
# Kill the server again, now we're sure the read request has been sent once
|
# Kill the server now that the timeout has happened.
|
||||||
sc1.close
|
sc1.close
|
||||||
|
|
||||||
# We expect the proxy to reconnect without our client doing anything.
|
# We expect the proxy to reconnect without our client doing anything.
|
||||||
@@ -247,6 +251,8 @@ module ProxyTests
|
|||||||
# And once reconnected, it should resend an identical request.
|
# And once reconnected, it should resend an identical request.
|
||||||
req2 = sc2.read_request
|
req2 = sc2.read_request
|
||||||
assert_equal req1, req2
|
assert_equal req1, req2
|
||||||
|
|
||||||
|
# And now lets read the data to make sure we get it all.
|
||||||
data2 = sc2.read_data(req2[:len])
|
data2 = sc2.read_data(req2[:len])
|
||||||
assert_equal data1, data2
|
assert_equal data1, data2
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user