From 2e17e8955fef0ecb4f2c23dcf02ba8ee27788088 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 13 Feb 2018 17:04:51 +0000 Subject: [PATCH] Added tests for NBD_MAX_SIZE This constant is only used in the proxy, so the tests only cover proxy mode. --- tests/acceptance/proxy_tests.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/acceptance/proxy_tests.rb b/tests/acceptance/proxy_tests.rb index 65fe38a..897c487 100644 --- a/tests/acceptance/proxy_tests.rb +++ b/tests/acceptance/proxy_tests.rb @@ -207,4 +207,17 @@ module ProxyTests end end end + + def test_maximum_write_request_size + # Defined in src/common/nbdtypes.h + nbd_max_block_size = 32 * 1024 * 1024 + @env.writefile1('0' * 40 * 1024) + with_proxied_client do |client| + # This will crash with EPIPE if the proxy dies. + client.write(0, b * nbd_max_block_size) + rsp = client.read_response + assert_equal FlexNBD::REPLY_MAGIC, rsp[:magic] + assert_equal 0, rsp[:error] + end + end end