From 3f5af49cfd74f2e5dafacd3dfbf3eb7fa6634f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 22 Nov 2018 10:41:02 +0100 Subject: Fix compress buffering tests before OTP 20.1 --- test/compress_SUITE.erl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/compress_SUITE.erl b/test/compress_SUITE.erl index 148eb46..2fa006a 100644 --- a/test/compress_SUITE.erl +++ b/test/compress_SUITE.erl @@ -198,8 +198,13 @@ opts_compress_buffering_true(Config0) -> Z = zlib:open(), zlib:inflateInit(Z, 31), %% The data gets buffered because it is too small. - {data, nofin, Data1} = gun:await(ConnPid, Ref, 500), - <<>> = iolist_to_binary(zlib:inflate(Z, Data1)), + %% In zlib versions before OTP 20.1 the gzip header was also buffered. + <<>> = case gun:await(ConnPid, Ref, 500) of + {data, nofin, Data1} -> + iolist_to_binary(zlib:inflate(Z, Data1)); + {error, timeout} -> + <<>> + end, gun:close(ConnPid) after cowboy:stop_listener(?FUNCTION_NAME) @@ -258,8 +263,13 @@ set_options_compress_buffering_true(Config0) -> Z = zlib:open(), zlib:inflateInit(Z, 31), %% The data gets buffered because it is too small. - {data, nofin, Data1} = gun:await(ConnPid, Ref, 500), - <<>> = iolist_to_binary(zlib:inflate(Z, Data1)), + %% In zlib versions before OTP 20.1 the gzip header was also buffered. + <<>> = case gun:await(ConnPid, Ref, 500) of + {data, nofin, Data1} -> + iolist_to_binary(zlib:inflate(Z, Data1)); + {error, timeout} -> + <<>> + end, gun:close(ConnPid) after cowboy:stop_listener(?FUNCTION_NAME) -- cgit v1.2.3