Skip to content

Commit 088fc4b

Browse files
fix: modify utils to set log_excerpt to empty string after conversion (#1682)
* fix: modify utils to set log_excerpt to empty string after conversion * test: fix log_excerpt unit tests
1 parent ac573c3 commit 088fc4b

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

backend/kernelCI_app/management/commands/helpers/log_excerpt_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def set_log_excerpt_ofile(item: dict[str, Any], url: str) -> dict[str, Any]:
9292
9393
item is a build or test
9494
"""
95-
item["log_excerpt"] = None
95+
item["log_excerpt"] = ""
9696
data = {
9797
"name": "log_excerpt",
9898
"url": url,

backend/kernelCI_app/tests/unitTests/commands/monitorSubmissions/log_excerpt_utils_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_set_log_excerpt_ofile_new_output_files(self):
219219
LOG_URL_MOCK,
220220
)
221221

222-
assert result["log_excerpt"] is None
222+
assert result["log_excerpt"] == ""
223223
assert "output_files" in result
224224
assert len(result["output_files"]) == 1
225225
assert result["output_files"][0] == {"name": "log_excerpt", "url": LOG_URL_MOCK}
@@ -238,7 +238,7 @@ def test_set_log_excerpt_ofile_existing_output_files(self):
238238
LOG_URL_MOCK,
239239
)
240240

241-
assert result["log_excerpt"] is None
241+
assert result["log_excerpt"] == ""
242242
assert len(result["output_files"]) == 2
243243
assert result["output_files"][1] == {"name": "log_excerpt", "url": LOG_URL_MOCK}
244244

@@ -291,7 +291,7 @@ def test_process_log_excerpt_large_not_cached(
291291
"""Test processing large log excerpt not in cache."""
292292

293293
def side_effect_set_log_excerpt_ofile(item, url):
294-
item["log_excerpt"] = None
294+
item["log_excerpt"] = ""
295295
if "output_files" not in item or not isinstance(item["output_files"], list):
296296
item["output_files"] = []
297297
item["output_files"].append({"name": "log_excerpt", "url": url})
@@ -311,7 +311,7 @@ def side_effect_set_log_excerpt_ofile(item, url):
311311
mock_upload_logexcerpt.assert_called_once()
312312
mock_set_in_cache.assert_called_once()
313313
mock_set_log_excerpt_ofile.assert_called_once()
314-
assert item["log_excerpt"] is None
314+
assert item["log_excerpt"] == ""
315315
assert "output_files" in item
316316
assert len(item["output_files"]) == 1
317317

@@ -342,7 +342,7 @@ def test_process_log_excerpt_large_cached(
342342
"""Test processing large log excerpt already in cache."""
343343

344344
def side_effect_set_log_excerpt_ofile(item, url):
345-
item["log_excerpt"] = None
345+
item["log_excerpt"] = ""
346346
if "output_files" not in item or not isinstance(item["output_files"], list):
347347
item["output_files"] = []
348348
item["output_files"].append({"name": "log_excerpt", "url": url})
@@ -361,7 +361,7 @@ def side_effect_set_log_excerpt_ofile(item, url):
361361
mock_upload_logexcerpt.assert_not_called()
362362
mock_set_in_cache.assert_not_called()
363363
mock_set_log_excerpt_ofile.assert_called_once()
364-
assert item["log_excerpt"] is None
364+
assert item["log_excerpt"] == ""
365365
assert "output_files" in item
366366
assert len(item["output_files"]) == 1
367367

0 commit comments

Comments
 (0)