From 4e0e0efa56fcf0934ba4c88b86d8a3371d83351a Mon Sep 17 00:00:00 2001 From: Vadim Sadokhov Date: Mon, 30 Mar 2026 16:49:56 +0300 Subject: [PATCH 1/3] fix tests --- .../tests/http_server/test_multipart.py | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/python/tests/http_server/test_multipart.py b/tests/python/tests/http_server/test_multipart.py index 5b82ff6bf0..410160afb2 100644 --- a/tests/python/tests/http_server/test_multipart.py +++ b/tests/python/tests/http_server/test_multipart.py @@ -1,8 +1,14 @@ import os +import re from urllib.parse import urlencode from python.lib.testcase import WebServerAutoTestCase +def get_multipart_temp_files(): + """Get files that look like multipart temp files (6 random alphanumeric chars in /tmp/).""" + pattern = re.compile(r'^[a-zA-Z0-9]{6}$') + return set(f for f in os.listdir("/tmp/") if pattern.match(f) and os.path.isfile(f"/tmp/{f}")) + class TestMultipartContentType(WebServerAutoTestCase): @@ -190,7 +196,7 @@ def test_multipart_non_terminating_boundary(self): def test_multipart_filename_attribute(self): - tmp_files = os.listdir("/tmp/") + tmp_files = get_multipart_temp_files() boundary = "------------------------d74496d66958873e" file_bytes = b"Hello from test.txt\nSecond line\n" @@ -221,12 +227,12 @@ def test_multipart_filename_attribute(self): self.assertTrue(response.content.find(b"filename : test.txt") != -1) self.assertTrue(response.content.find(b"Hello from test.txt") != -1) - tmp_files_after_script = os.listdir("/tmp/") + tmp_files_after_script = get_multipart_temp_files() # check that script delete tmp files at the end self.assertEqual(sorted(tmp_files), sorted(tmp_files_after_script)) def test_multipart_filename_array_attribute(self): - tmp_files = os.listdir("/tmp/") + tmp_files = get_multipart_temp_files() boundary = "------------------------d74496d66958873e" @@ -270,13 +276,13 @@ def test_multipart_filename_array_attribute(self): self.assertTrue(response.content.find(b"Hello from a.txt") != -1) self.assertTrue(response.content.find(b"Hello from b.txt") != -1) - tmp_files_after_script = os.listdir("/tmp/") + tmp_files_after_script = get_multipart_temp_files() # check that script delete tmp files at the end self.assertEqual(sorted(tmp_files), sorted(tmp_files_after_script)) def test_multipart_superglobal_modify(self): - tmp_files = os.listdir("/tmp/") + tmp_files = get_multipart_temp_files() boundary = "------------------------d74496d66958873e" file_bytes = b"Hello from test.txt\nSecond line\n" @@ -305,13 +311,13 @@ def test_multipart_superglobal_modify(self): self.assertEqual(200, response.status_code) - tmp_files_after_script = os.listdir("/tmp/") + tmp_files_after_script = get_multipart_temp_files() # check that script delete tmp files at the end self.assertEqual(sorted(tmp_files), sorted(tmp_files_after_script)) def test_multipart_mixed_files_and_fields(self): """Test mixing files and regular form fields in the same request.""" - tmp_files = os.listdir("/tmp/") + tmp_files = get_multipart_temp_files() boundary = '------------------------d74496d66958873e' file_bytes = b'File content here\n' @@ -350,13 +356,13 @@ def test_multipart_mixed_files_and_fields(self): self.assertTrue(response.content.find(b'filename : test.txt') != -1) self.assertTrue(response.content.find(b'another : another value') != -1) - tmp_files_after_script = os.listdir("/tmp/") + tmp_files_after_script = get_multipart_temp_files() # check that script delete tmp files at the end self.assertEqual(sorted(tmp_files), sorted(tmp_files_after_script)) def test_multipart_file_without_content_type(self): """Test file upload without explicit Content-Type header.""" - tmp_files = os.listdir("/tmp/") + tmp_files = get_multipart_temp_files() boundary = '------------------------d74496d66958873e' file_bytes = b'File without content type\n' @@ -387,13 +393,13 @@ def test_multipart_file_without_content_type(self): # Should default to text/plain self.assertTrue(response.content.find(b'type : text/plain') != -1) - tmp_files_after_script = os.listdir("/tmp/") + tmp_files_after_script = get_multipart_temp_files() # check that script delete tmp files at the end self.assertEqual(sorted(tmp_files), sorted(tmp_files_after_script)) def test_multipart_binary_file(self): """Test uploading binary file content.""" - tmp_files = os.listdir("/tmp/") + tmp_files = get_multipart_temp_files() boundary = '------------------------d74496d66958873e' # Binary content with null bytes @@ -424,7 +430,7 @@ def test_multipart_binary_file(self): self.assertTrue(response.content.find(b'size : 8') != -1) self.assertTrue(response.content.find(b'filename : data.bin') != -1) - tmp_files_after_script = os.listdir("/tmp/") + tmp_files_after_script = get_multipart_temp_files() # check that script delete tmp files at the end self.assertEqual(sorted(tmp_files), sorted(tmp_files_after_script)) From 0562e8efbb9dd392fbbad3fd4e83668920bc7a96 Mon Sep 17 00:00:00 2001 From: Vadim Sadokhov Date: Mon, 30 Mar 2026 17:47:27 +0300 Subject: [PATCH 2/3] fix tests --- tests/python/tests/http_server/test_multipart.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/python/tests/http_server/test_multipart.py b/tests/python/tests/http_server/test_multipart.py index 410160afb2..7fcf64d95b 100644 --- a/tests/python/tests/http_server/test_multipart.py +++ b/tests/python/tests/http_server/test_multipart.py @@ -5,8 +5,8 @@ from python.lib.testcase import WebServerAutoTestCase def get_multipart_temp_files(): - """Get files that look like multipart temp files (6 random alphanumeric chars in /tmp/).""" - pattern = re.compile(r'^[a-zA-Z0-9]{6}$') + """Get files that look like multipart temp files (6 random alphanumeric chars in /tmp/, optionally with tmp. prefix).""" + pattern = re.compile(r'^(tmp\.)?[a-zA-Z0-9]{6}$') return set(f for f in os.listdir("/tmp/") if pattern.match(f) and os.path.isfile(f"/tmp/{f}")) From 6a046bfd3599a23efee42abeb18c316a7b84d29e Mon Sep 17 00:00:00 2001 From: Vadim Sadokhov Date: Tue, 31 Mar 2026 14:56:18 +0300 Subject: [PATCH 3/3] delete extra log tag --- tests/python/lib/k2_server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/python/lib/k2_server.py b/tests/python/lib/k2_server.py index 493de94c09..f31fdfa254 100644 --- a/tests/python/lib/k2_server.py +++ b/tests/python/lib/k2_server.py @@ -64,6 +64,7 @@ def _process_json_log(self, log_record): log_record.pop("time", "") log_record.pop("thread_id", "") log_record.pop("component_name", "") + log_record.pop("component_version", "") log_record.pop("level", "") log_record.pop("target", "") log_record.pop("instance_id", "")