()
| 26 | |
| 27 | |
| 28 | def main() -> int: |
| 29 | parser = argparse.ArgumentParser( |
| 30 | prog="lint-tests-flags", |
| 31 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 32 | description="Check that new configs are used in parallel workload and other tests", |
| 33 | ) |
| 34 | parser.parse_args() |
| 35 | |
| 36 | configs = [] |
| 37 | |
| 38 | for path in Path("src").rglob("*.rs"): |
| 39 | if path in [Path("src/dyncfg/src/lib.rs"), Path("src/dyncfg-file/src/lib.rs")]: |
| 40 | continue # contains tests |
| 41 | with path.open(encoding="utf-8") as file: |
| 42 | content = file.read() |
| 43 | if matches := CONFIG_REGEX.findall(content): |
| 44 | configs.extend(matches) |
| 45 | |
| 46 | action = FlipFlagsAction(random.Random(), None) |
| 47 | parallel_workload_known_flags = set(action.flags_with_values).union( |
| 48 | action.uninteresting_flags |
| 49 | ) |
| 50 | mzcompose_known_flags = set( |
| 51 | get_default_system_parameters(MzVersion.parse_cargo()).keys() |
| 52 | ).union(UNINTERESTING_SYSTEM_PARAMETERS) |
| 53 | found = False |
| 54 | |
| 55 | for config in configs: |
| 56 | if config not in parallel_workload_known_flags: |
| 57 | print( |
| 58 | f'Configuration flag "{config}" seems to have been introduced/changed. Make sure parallel-workload\'s FlipFlagsAction in misc/python/materialize/parallel_workload/action.py knows about some valid values for it' |
| 59 | ) |
| 60 | found = True |
| 61 | |
| 62 | for config in configs: |
| 63 | if config not in mzcompose_known_flags: |
| 64 | print( |
| 65 | f'Configuration flag "{config}" seems to have been introduced/changed. Make sure get_variable_system_parameters/get_minimal_system_parameters/UNINTERESTING_SYSTEM_PARAMETERS in misc/python/materialize/mzcompose/__init__.py knows about some valid values for it' |
| 66 | ) |
| 67 | found = True |
| 68 | |
| 69 | return int(found) |
| 70 | |
| 71 | |
| 72 | if __name__ == "__main__": |
no test coverage detected