summaryrefslogtreecommitdiff
path: root/buildscripts/resmokelib
diff options
context:
space:
mode:
authorTrevor Guidry <trevor.guidry@mongodb.com>2023-04-13 15:45:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-13 18:22:34 +0000
commit2e539bca96904af3d88d2e33e7c0bcf39bb8f47e (patch)
tree90363a4c127c893c0ba87b3930560aec08f2e242 /buildscripts/resmokelib
parent2ad1e9ac43f4427fbcd6690c64c47e6bc26cce94 (diff)
downloadmongo-2e539bca96904af3d88d2e33e7c0bcf39bb8f47e.tar.gz
SERVER-75688 readd matrix suite validation
Diffstat (limited to 'buildscripts/resmokelib')
-rw-r--r--buildscripts/resmokelib/run/__init__.py3
-rw-r--r--buildscripts/resmokelib/suitesconfig.py42
2 files changed, 27 insertions, 18 deletions
diff --git a/buildscripts/resmokelib/run/__init__.py b/buildscripts/resmokelib/run/__init__.py
index 2afd9aa64e1..3c756f8c521 100644
--- a/buildscripts/resmokelib/run/__init__.py
+++ b/buildscripts/resmokelib/run/__init__.py
@@ -442,6 +442,9 @@ class TestRunner(Subcommand):
self._resmoke_logger.error("Failed to parse YAML suite definition: %s", str(err))
self.list_suites()
self.exit(1)
+ except errors.InvalidMatrixSuiteError as err:
+ self._resmoke_logger.error("Failed to get matrix suite: %s", str(err))
+ self.exit(1)
except errors.ResmokeError as err:
self._resmoke_logger.error(
"Cannot run excluded test in suite config. Use '--force-excluded-tests' to override: %s",
diff --git a/buildscripts/resmokelib/suitesconfig.py b/buildscripts/resmokelib/suitesconfig.py
index 0fe935b05aa..55295c7b07a 100644
--- a/buildscripts/resmokelib/suitesconfig.py
+++ b/buildscripts/resmokelib/suitesconfig.py
@@ -2,6 +2,7 @@
import collections
import copy
import os
+import pathlib
from threading import Lock
from typing import Dict, List
@@ -234,23 +235,26 @@ class MatrixSuiteConfig(SuiteConfigInterface):
if not config:
return None
- # TODO: SERVER-75688 add validation back
- # generated_path = cls.get_generated_suite_path(suite_name)
- # if not os.path.exists(generated_path):
- # raise errors.InvalidMatrixSuiteError(
- # f"No generated suite file was found for {suite_name}" +
- # "To (re)generate the matrix suite files use `python3 buildscripts/resmoke.py generate-matrix-suites`"
- # )
-
- # new_text = cls.generate_matrix_suite_text(suite_name)
- # with open(generated_path, "r") as file:
- # old_text = file.read()
- # if new_text != old_text:
- # raise errors.InvalidMatrixSuiteError(
- # f"The generated file found on disk did not match the mapping file for {suite_name}. "
- # +
- # "To (re)generate the matrix suite files use `python3 buildscripts/resmoke.py generate-matrix-suites`"
- # )
+ generated_path = cls.get_generated_suite_path(suite_name)
+ if not os.path.exists(generated_path):
+ raise errors.InvalidMatrixSuiteError(
+ f"No generated suite file was found for {suite_name}" +
+ "To (re)generate the matrix suite files use `python3 buildscripts/resmoke.py generate-matrix-suites`"
+ )
+
+ new_text = cls.generate_matrix_suite_text(suite_name)
+ with open(generated_path, "r") as file:
+ old_text = file.read()
+ if new_text != old_text:
+ loggers.ROOT_EXECUTOR_LOGGER.error("Generated file on disk:")
+ loggers.ROOT_EXECUTOR_LOGGER.error(old_text)
+ loggers.ROOT_EXECUTOR_LOGGER.error("Generated text from mapping file:")
+ loggers.ROOT_EXECUTOR_LOGGER.error(new_text)
+ raise errors.InvalidMatrixSuiteError(
+ f"The generated file found on disk did not match the mapping file for {suite_name}. "
+ +
+ "To (re)generate the matrix suite files use `python3 buildscripts/resmoke.py generate-matrix-suites`"
+ )
return config
@@ -418,6 +422,8 @@ class MatrixSuiteConfig(SuiteConfigInterface):
print(f"Could not find mappings file for {suite_name}")
return None
+ # This path needs to output the same text on both windows and linux/mac
+ mapping_path = pathlib.PurePath(mapping_path)
yml = yaml.safe_dump(matrix_suite)
comments = [
"##########################################################",
@@ -425,7 +431,7 @@ class MatrixSuiteConfig(SuiteConfigInterface):
"# IF YOU WISH TO MODIFY THIS SUITE, MODIFY THE CORRESPONDING MATRIX SUITE MAPPING FILE",
"# AND REGENERATE THE MATRIX SUITES.",
"#",
- f"# matrix suite mapping file: {mapping_path}",
+ f"# matrix suite mapping file: {mapping_path.as_posix()}",
"# regenerate matrix suites: buildscripts/resmoke.py generate-matrix-suites",
"##########################################################",
]