From 54837759f36eddb80af22c8d73e103a948221dc7 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Mon, 19 Oct 2020 22:25:29 +0100 Subject: Tests: fixed unit.log print. --- test/test_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/test_settings.py') diff --git a/test/test_settings.py b/test/test_settings.py index b0af6b04..30aa2bff 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -146,14 +146,14 @@ Connection: close assert resp['status'] == 200, 'status body read timeout update' - def test_settings_send_timeout(self): + def test_settings_send_timeout(self, temp_dir): self.load('mirror') data_len = 1048576 self.conf({'http': {'send_timeout': 1}}, 'settings') - addr = self.temp_dir + '/sock' + addr = temp_dir + '/sock' self.conf({"unix:" + addr: {'application': 'mirror'}}, 'listeners') -- cgit From 3278253d51666e0b83a83b10d5ff7f391cc55f3f Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Thu, 12 Nov 2020 00:07:08 +0000 Subject: Tests: added a test for "body_buffer_size" option. --- test/test_settings.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test/test_settings.py') diff --git a/test/test_settings.py b/test/test_settings.py index 30aa2bff..22830a3b 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -260,3 +260,41 @@ Connection: close assert 'error' in self.conf( {'http': {'max_body_size': -1}}, 'settings' ), 'settings negative value' + + def test_settings_body_buffer_size(self): + self.load('mirror') + + assert 'success' in self.conf( + { + 'http': { + 'max_body_size': 64 * 1024 * 1024, + 'body_buffer_size': 32 * 1024 * 1024, + } + }, + 'settings', + ) + + body = '0123456789abcdef' + resp = self.post(body=body) + assert bool(resp), 'response from application' + assert resp['status'] == 200, 'status' + assert resp['body'] == body, 'body' + + body = '0123456789abcdef' * 1024 * 1024 + resp = self.post(body=body, read_buffer_size=1024 * 1024) + assert bool(resp), 'response from application 2' + assert resp['status'] == 200, 'status 2' + assert resp['body'] == body, 'body 2' + + body = '0123456789abcdef' * 2 * 1024 * 1024 + resp = self.post(body=body, read_buffer_size=1024 * 1024) + assert bool(resp), 'response from application 3' + assert resp['status'] == 200, 'status 3' + assert resp['body'] == body, 'body 3' + + body = '0123456789abcdef' * 3 * 1024 * 1024 + resp = self.post(body=body, read_buffer_size=1024 * 1024) + assert bool(resp), 'response from application 4' + assert resp['status'] == 200, 'status 4' + assert resp['body'] == body, 'body 4' + -- cgit