From b7b50faa17d63d8d0935e82c9500ed7a825f79c8 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 14 Nov 2018 16:57:24 +0000 Subject: [PATCH] Updated comments --- tests/acceptance/proxy_tests.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/proxy_tests.rb b/tests/acceptance/proxy_tests.rb index 2296453..d181add 100644 --- a/tests/acceptance/proxy_tests.rb +++ b/tests/acceptance/proxy_tests.rb @@ -158,7 +158,7 @@ module ProxyTests # Send the read request to the proxy client.write(0, (b * 4096)) - # ensure we're given the read request + # ensure we're given the write request req1 = sc1.read_request assert_equal ::FlexNBD::REQUEST_MAGIC, req1[:magic] assert_equal ::FlexNBD::REQUEST_WRITE, req1[:type] @@ -221,15 +221,19 @@ module ProxyTests # Send the read request to the proxy client.write(0, data1) - # ensure we're given the read request + # ensure we're given the write request req1 = sc1.read_request assert_equal ::FlexNBD::REQUEST_MAGIC, req1[:magic] assert_equal ::FlexNBD::REQUEST_WRITE, req1[:type] assert_equal 0, req1[:from] 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 sleep 5 + # 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 # the whole request has been buffered. If this is the case, then the @@ -237,7 +241,7 @@ module ProxyTests # we're trying to test. 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 # 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. req2 = sc2.read_request assert_equal req1, req2 + + # And now lets read the data to make sure we get it all. data2 = sc2.read_data(req2[:len]) assert_equal data1, data2