summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjasurbeknurboyev <998946972365>2023-01-26 22:07:21 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-01-26 23:52:18 +0000
commitc18ffc704499fd2946fbf57fe97b8abc107c27e2 (patch)
tree6ac89228e09319832e0d0d1e04490b64c8410103
parentce266d98b7dda26421bf29e31e6e79556e5d9535 (diff)
downloadmongo-c18ffc704499fd2946fbf57fe97b8abc107c27e2.tar.gz
SERVER-72866 resmoke symbolizer service raises Python error when stacktrace file isn't found
-rw-r--r--buildscripts/resmokelib/testing/symbolizer_service.py9
-rw-r--r--buildscripts/tests/resmokelib/testing/test_symbolizer_service.py5
2 files changed, 13 insertions, 1 deletions
diff --git a/buildscripts/resmokelib/testing/symbolizer_service.py b/buildscripts/resmokelib/testing/symbolizer_service.py
index 866a4209239..767e8cb5092 100644
--- a/buildscripts/resmokelib/testing/symbolizer_service.py
+++ b/buildscripts/resmokelib/testing/symbolizer_service.py
@@ -271,7 +271,14 @@ class FileService:
:param files: list of paths
:return: Non-empty files
"""
- return [f for f in files if not os.stat(f).st_size == 0]
+ filtered_files = []
+ for file in files:
+ try:
+ if not os.stat(file).st_size == 0:
+ filtered_files.append(file)
+ except FileNotFoundError:
+ pass
+ return filtered_files
@staticmethod
def check_path_exists(path: str) -> bool:
diff --git a/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py b/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py
index 06b0cc9991e..f230f29d6af 100644
--- a/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py
+++ b/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py
@@ -196,6 +196,11 @@ class TestFileService(unittest.TestCase):
self.assertEqual(
set(self.file_service.filter_out_empty_files(abs_file_paths)), set(abs_file_paths))
+ def test_do_not_panic_when_file_does_not(self):
+ non_existing_files = ["this-does-not-exist.file", "my.cat"]
+ # non-existing files should be filtered out, instead of causing errors
+ self.assertListEqual(self.file_service.filter_out_empty_files(non_existing_files), [])
+
def test_filter_out_empty_files_if_partly_empty(self):
with TemporaryDirectory() as tmpdir:
abs_dir_paths = [os.path.join(tmpdir, d) for d in self.relative_dir_paths]