SERVER-109266: Improve logs from test_find_suites.py and test_suites_configurations.py (#40057)

GitOrigin-RevId: 8de14b36a2f8225b5a11a696b8a073e1836daafe
This commit is contained in:
Steve McClure 2025-08-14 09:32:38 -04:00 committed by MongoDB Bot
parent a9a9338beb
commit 0274d2486d
3 changed files with 14 additions and 3 deletions

View File

@ -93,6 +93,12 @@ def create_test_membership_map(fail_on_missing_selector=False, test_kind=None):
if not fail_on_missing_selector: if not fail_on_missing_selector:
continue continue
raise raise
except KeyError as e:
# For example, `test_kind` might be missing from their yaml config
loggers.ROOT_EXECUTOR_LOGGER.error(
"Error occurred while processing suite '%s': Field %s not found.", suite_name, e
)
raise
return test_membership return test_membership

View File

@ -19,7 +19,9 @@ class TestFindSuites(unittest.TestCase):
self.assertEqual( self.assertEqual(
0, 0,
resmoke_process.returncode, resmoke_process.returncode,
msg="find-suites subcommand did not execute successfully.", # Give a very verbose failure message - this can be read by users well
# outside of resmoke-areas in case of failures on malformatted yaml configs
msg=f"find-suites subcommand did not execute successfully:\n\n{resmoke_process.stdout}",
) )
self.assertTrue(resmoke_process.stdout, msg="find-suites output must not be empty") self.assertTrue(resmoke_process.stdout, msg="find-suites output must not be empty")

View File

@ -9,8 +9,8 @@ class TestSuitesConfigurations(unittest.TestCase):
def test_validity_of_resmoke_suites_configurations(self): def test_validity_of_resmoke_suites_configurations(self):
set_run_options("--runAllFeatureFlagTests") set_run_options("--runAllFeatureFlagTests")
for suite_name in get_named_suites(): for suite_name in get_named_suites():
suite = get_suite(suite_name)
try: try:
suite = get_suite(suite_name)
suite.tests suite.tests
except IOError as err: except IOError as err:
# We ignore errors from missing files referenced in the test suite's "selector" # We ignore errors from missing files referenced in the test suite's "selector"
@ -19,5 +19,8 @@ class TestSuitesConfigurations(unittest.TestCase):
# associated bazel target hasn't been built yet. # associated bazel target hasn't been built yet.
if err.filename in config.EXTERNAL_SUITE_SELECTORS: if err.filename in config.EXTERNAL_SUITE_SELECTORS:
continue continue
except KeyError as e:
# For example, `test_kind` might be missing from their yaml config
self.fail(f"Error validating `{suite_name}` suite: Field {str(e)} not found.")
except Exception as ex: except Exception as ex:
self.fail(f"While validating `{suite.get_name()}` suite got an error: {str(ex)}") self.fail(f"Error validating `{suite_name}` suite: {str(ex)}")