mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fxi
This commit is contained in:
parent
fec4c57934
commit
9ad263b5ed
@ -849,7 +849,6 @@ class CiOptions:
|
||||
jobs_to_do: List[str],
|
||||
jobs_to_skip: List[str],
|
||||
jobs_params: Dict[str, Dict[str, Any]],
|
||||
run_only_if_included: bool,
|
||||
) -> Tuple[List[str], List[str], Dict[str, Dict[str, Any]]]:
|
||||
"""
|
||||
Applies specified options on CI Run Config
|
||||
@ -932,10 +931,6 @@ class CiOptions:
|
||||
)
|
||||
jobs_to_do_requested = list(label_config.run_jobs)
|
||||
|
||||
if run_only_if_included and not jobs_to_do_requested:
|
||||
jobs_to_skip += jobs_to_do
|
||||
jobs_to_do = []
|
||||
|
||||
if jobs_to_do_requested:
|
||||
jobs_to_do_requested = list(set(jobs_to_do_requested))
|
||||
print(
|
||||
@ -948,10 +943,12 @@ class CiOptions:
|
||||
# we need to add params - otherwise it won't run as "batches" list will be empty
|
||||
for job in jobs_to_do:
|
||||
if job not in jobs_params:
|
||||
num_batches = CI_CONFIG.get_job_config(job).num_batches
|
||||
job_config = CI_CONFIG.get_job_config(job)
|
||||
num_batches = job_config.num_batches
|
||||
jobs_params[job] = {
|
||||
"batches": list(range(num_batches)),
|
||||
"num_batches": num_batches,
|
||||
"run_if_ci_option_include_set": job_config.run_by_ci_option,
|
||||
}
|
||||
|
||||
# 4. Handle "batch_" tags
|
||||
@ -963,6 +960,18 @@ class CiOptions:
|
||||
if params["num_batches"] > 1:
|
||||
params["batches"] = self.job_batches
|
||||
|
||||
for job in jobs_to_do[:]:
|
||||
job_param = jobs_params[job]
|
||||
if (
|
||||
job_param["run_if_ci_option_include_set"]
|
||||
and job not in jobs_to_do_requested
|
||||
):
|
||||
print(
|
||||
f"Erasing job '{job}' from list because it's not in included set, but will run only by include"
|
||||
)
|
||||
jobs_to_skip.append(job)
|
||||
jobs_to_do.remove(job)
|
||||
|
||||
return jobs_to_do, jobs_to_skip, jobs_params
|
||||
|
||||
|
||||
@ -1455,7 +1464,7 @@ def _configure_jobs(
|
||||
]
|
||||
|
||||
jobs_to_do, jobs_to_skip, jobs_params = ci_options.apply(
|
||||
jobs_to_do, jobs_to_skip, jobs_params, job_config.run_by_ci_option
|
||||
jobs_to_do, jobs_to_skip, jobs_params
|
||||
)
|
||||
|
||||
return {
|
||||
|
@ -44,6 +44,10 @@ _TEST_BODY_3 = """
|
||||
- [x] <!---ci_include_analyzer--> Must include all tests for analyzer
|
||||
"""
|
||||
|
||||
_TEST_BODY_4 = """
|
||||
"""
|
||||
|
||||
|
||||
_TEST_JOB_LIST = [
|
||||
"Style check",
|
||||
"Fast test",
|
||||
@ -152,9 +156,15 @@ class TestCIOptions(unittest.TestCase):
|
||||
)
|
||||
jobs_to_do = list(_TEST_JOB_LIST)
|
||||
jobs_to_skip = []
|
||||
job_params = {}
|
||||
job_params = {
|
||||
"Stateless tests (azure, asan)": {
|
||||
"batches": list(range(3)),
|
||||
"num_batches": 3,
|
||||
"run_if_ci_option_include_set": True,
|
||||
}
|
||||
}
|
||||
jobs_to_do, jobs_to_skip, job_params = ci_options.apply(
|
||||
jobs_to_do, jobs_to_skip, job_params, False
|
||||
jobs_to_do, jobs_to_skip, job_params
|
||||
)
|
||||
self.assertCountEqual(
|
||||
jobs_to_do,
|
||||
@ -186,7 +196,7 @@ class TestCIOptions(unittest.TestCase):
|
||||
jobs_to_skip = []
|
||||
job_params = {}
|
||||
jobs_to_do, jobs_to_skip, job_params = ci_options.apply(
|
||||
jobs_to_do, jobs_to_skip, job_params, False
|
||||
jobs_to_do, jobs_to_skip, job_params
|
||||
)
|
||||
self.assertCountEqual(
|
||||
jobs_to_do,
|
||||
@ -198,3 +208,32 @@ class TestCIOptions(unittest.TestCase):
|
||||
"package_asan",
|
||||
],
|
||||
)
|
||||
|
||||
def test_options_applied_2(self):
|
||||
self.maxDiff = None
|
||||
ci_options = CiOptions.create_from_pr_message(
|
||||
_TEST_BODY_4, update_from_api=False
|
||||
)
|
||||
self.assertIsNone(ci_options.include_keywords, None)
|
||||
self.assertIsNone(ci_options.exclude_keywords, None)
|
||||
jobs_to_do = list(_TEST_JOB_LIST)
|
||||
jobs_to_skip = []
|
||||
job_params = {}
|
||||
|
||||
for job in _TEST_JOB_LIST:
|
||||
if "Stateless" in job:
|
||||
job_params[job] = {
|
||||
"batches": list(range(3)),
|
||||
"num_batches": 3,
|
||||
"run_if_ci_option_include_set": True if "azure" in job else False,
|
||||
}
|
||||
else:
|
||||
job_params[job] = {"run_if_ci_option_include_set": False}
|
||||
|
||||
jobs_to_do, jobs_to_skip, job_params = ci_options.apply(
|
||||
jobs_to_do, jobs_to_skip, job_params
|
||||
)
|
||||
self.assertNotIn(
|
||||
"Stateless tests (azure, asan)",
|
||||
jobs_to_do,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user