mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Add another check to CiConfig.validate, and test for it
This commit is contained in:
parent
db8a548718
commit
38b251946e
@ -50,21 +50,27 @@ class CiConfig:
|
||||
|
||||
def validate(self) -> None:
|
||||
errors = []
|
||||
# All build configs must belong to build_report_config
|
||||
for build_name in self.build_config.keys():
|
||||
for name, build_config in self.build_config.items():
|
||||
build_in_reports = False
|
||||
for report_config in self.builds_report_config.values():
|
||||
if build_name in report_config:
|
||||
if name in report_config:
|
||||
build_in_reports = True
|
||||
break
|
||||
# All build configs must belong to build_report_config
|
||||
if not build_in_reports:
|
||||
logging.error("Build name %s does not belong to build reports", name)
|
||||
errors.append(f"Build name {name} does not belong to build reports")
|
||||
# The name should be the same as build_config.name
|
||||
if not build_config.name == name:
|
||||
logging.error(
|
||||
"Build name %s does not belong to build reports", build_name
|
||||
"Build name '%s' does not match the config 'name' value '%s'",
|
||||
name,
|
||||
build_config.name,
|
||||
)
|
||||
errors.append(
|
||||
f"Build name {build_name} does not belong to build reports"
|
||||
f"Build name {name} does not match 'name' value '{build_config.name}'"
|
||||
)
|
||||
# And otherwise
|
||||
# All build_report_config values should be in build_config.keys()
|
||||
for build_report_name, build_names in self.builds_report_config.items():
|
||||
missed_names = [
|
||||
name for name in build_names if name not in self.build_config.keys()
|
||||
|
15
tests/ci/test_ci_config.py
Normal file
15
tests/ci/test_ci_config.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
class TestCiConfig(unittest.TestCase):
|
||||
def test_no_errors_in_ci_config(self):
|
||||
raised = None
|
||||
try:
|
||||
from ci_config import ( # pylint: disable=import-outside-toplevel
|
||||
CI_CONFIG as _,
|
||||
)
|
||||
except Exception as exc:
|
||||
raised = exc
|
||||
self.assertIsNone(raised, f"CI_CONFIG import raised error {raised}")
|
Loading…
Reference in New Issue
Block a user