From e39078135e901890cfca9c887a9331feb2b8b06d Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Wed, 17 Jan 2024 11:16:03 -0800 Subject: [PATCH] tests: Exercise recent eventlet breakage without XFS Recently, upper-constraints updated eventlet. Unfortunately, there was a bug which breaks our unit tests which was not discovered during the cross-project testing because the affected unit tests require an XFS temp dir. The requirements change has since been reverted, but we ought to have tests that cover the problematic behavior that will actually run as part of cross-project testing. See https://github.com/eventlet/eventlet/pull/826 for the eventlet change that introduced the bug; it has since been fixed on master in https://github.com/eventlet/eventlet/pull/890 (though we still need https://review.opendev.org/c/openstack/swift/+/905796 to be able to work with eventlet master). Change-Id: I4a6d79317b65f746ee29d2d25073b8c3859cd6a0 --- test/unit/common/test_http_protocol.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/unit/common/test_http_protocol.py b/test/unit/common/test_http_protocol.py index a91aacf16a..cb9772dd2c 100644 --- a/test/unit/common/test_http_protocol.py +++ b/test/unit/common/test_http_protocol.py @@ -297,6 +297,28 @@ class TestSwiftHttpProtocolSomeMore(ProtocolTest): lines = [l for l in bytes_out.split(b"\r\n") if l] self.assertEqual(lines[-1], b'///some-leading-slashes') + def test_chunked_with_content_length(self): + def reflecting_app(env, start_response): + start_response('200 OK', []) + return [env['wsgi.input'].read()] + + # This is more of a test of eventlet, but we've seen issues with it + # before that were only caught in unit tests that require an XFS + # tempdir, and so were skipped on the requirements job + bytes_out = self._run_bytes_through_protocol(( + b"PUT /path HTTP/1.0\r\n" + b"Content-Length: 10\r\n" + b"Transfer-Encoding: chunked\r\n" + b"\r\n" + b"a\r\n" + b"some text\n" + b"\r\n" + b"0\r\n" + b"\r\n" + ), app=reflecting_app) + body = bytes_out.partition(b"\r\n\r\n")[2] + self.assertEqual(body, b'some text\n') + def test_request_lines(self): def app(env, start_response): start_response("200 OK", [])