SERVER-100523 generate-matrix-suites keeps generated suites in sync with mappings (#48394)
Co-authored-by: Nick Jefferies <nick.jefferies@mongodb.com> GitOrigin-RevId: 852adc50c1e8956bb1f5d0fc7a41cfd03b889753
This commit is contained in:
committed by
MongoDB Bot
parent
1fc95f949c
commit
58bc053e2e
@@ -22,7 +22,7 @@ their eponymous directories. When you are done writing the mapping file, you mus
|
||||
|
||||
The "mappings" directory contains YAML files that each contain a suite definition.
|
||||
Each suite definition includes `base_suite`, and a list of
|
||||
modifiers. There is also an optional `decription` field that will get output
|
||||
modifiers. There is also an optional `description` field that will get output
|
||||
with the local resmoke invocation.
|
||||
|
||||
The fields of modifiers are the following:
|
||||
@@ -70,7 +70,7 @@ The generated matrix suites live in the `buildscripts/resmokeconfig/matrix_suite
|
||||
directory. These files may be edited for local testing but must remain consistent with the mapping
|
||||
files. There is a task in the commit queue that enforces this. To generate a new version of these
|
||||
matrix suites, you may run
|
||||
`buildscripts/resmoke.py generate-matrix-suites. This command
|
||||
`buildscripts/resmoke.py generate-matrix-suites`. This command
|
||||
will overwrite the current generated matrix suites on disk so make sure you do not have any unsaved
|
||||
changes to these files.
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import copy
|
||||
import itertools
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
from threading import Lock
|
||||
from typing import Any, Optional
|
||||
@@ -760,6 +761,14 @@ class MatrixSuiteConfig(SuiteConfigInterface):
|
||||
|
||||
@classmethod
|
||||
def generate_all_matrix_suite_files(cls):
|
||||
# To make sure we don't keep generated suites around for mappings that no longer exist,
|
||||
# delete any previously generated suites first.
|
||||
suite_dirs = cls.get_suites_dirs()
|
||||
for suite_dir in suite_dirs:
|
||||
generated_suites = os.path.join(suite_dir, "generated_suites")
|
||||
if os.path.isdir(generated_suites):
|
||||
shutil.rmtree(generated_suites)
|
||||
|
||||
suite_names = cls.get_named_suites()
|
||||
for suite_name in suite_names:
|
||||
cls.generate_matrix_suite_file(suite_name)
|
||||
|
||||
@@ -21,6 +21,9 @@ py_test(
|
||||
py_test(
|
||||
name = "test_generated_matrix_suites",
|
||||
srcs = ["test_generated_matrix_suites.py"],
|
||||
data = [
|
||||
"//buildscripts/resmokeconfig:all_files",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//buildscripts/resmokelib",
|
||||
|
||||
@@ -49,8 +49,12 @@ class ValidateGeneratedSuites(unittest.TestCase):
|
||||
self.assertIn(
|
||||
suite_name,
|
||||
suite_names,
|
||||
msg=f"{filename} does not have a correlated mapping file . Make a mapping file or delete it."
|
||||
msg=f"{filename} does not have a correlated mapping file. Make a mapping file or delete it."
|
||||
f"You have a generated file {filename} that does not have a corresponding mapping file {expected_mapping_file}. "
|
||||
+ "If you have added a non matrix suite to resmokeconfig/matrix_suites/generated_suites, move it to the resmokeconfig/suites."
|
||||
+ " If you have removed the mapping file be sure to remove the generated file.",
|
||||
+ " If you have removed the mapping file be sure to rerun buildscripts/resmoke.py generate-matrix-suites.",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
"replset",
|
||||
"reprioritization",
|
||||
"reprioritized",
|
||||
"resmoke",
|
||||
"resumability",
|
||||
"retryable",
|
||||
"RSTL",
|
||||
|
||||
Reference in New Issue
Block a user