configuration.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. from materialize.output_consistency.execution.query_output_mode import (
  10. QueryOutputMode,
  11. )
  12. from materialize.output_consistency.input_data.scenarios.evaluation_scenario import (
  13. EvaluationScenario,
  14. )
  15. class ConsistencyTestConfiguration:
  16. def __init__(
  17. self,
  18. scenario: EvaluationScenario,
  19. queries_per_tx: int,
  20. use_autocommit: bool,
  21. max_cols_per_query: int,
  22. max_pending_expressions: int,
  23. random_seed: str,
  24. split_and_retry_on_db_error: bool,
  25. dry_run: bool,
  26. verbose_output: bool,
  27. print_reproduction_code: bool,
  28. max_runtime_in_sec: int,
  29. max_iterations: int,
  30. max_failures_until_abort: int,
  31. avoid_expressions_expecting_db_error: bool,
  32. disable_predefined_queries: bool,
  33. query_output_mode: QueryOutputMode,
  34. vertical_join_tables: int,
  35. ):
  36. self.scenario = scenario
  37. self.queries_per_tx = queries_per_tx
  38. self.use_autocommit = use_autocommit
  39. self.max_cols_per_query = max_cols_per_query
  40. self.max_pending_expressions = max_pending_expressions
  41. self.random_seed = random_seed
  42. self.split_and_retry_on_db_error = split_and_retry_on_db_error
  43. self.dry_run = dry_run
  44. self.verbose_output = verbose_output
  45. self.print_reproduction_code = print_reproduction_code
  46. self.max_runtime_in_sec = max_runtime_in_sec
  47. self.max_iterations = max_iterations
  48. self.max_failures_until_abort = max_failures_until_abort
  49. self.avoid_expressions_expecting_db_error = avoid_expressions_expecting_db_error
  50. self.disable_predefined_queries = disable_predefined_queries
  51. self.query_output_mode = query_output_mode
  52. self.vertical_join_tables = vertical_join_tables
  53. def validate(self) -> None:
  54. if self.max_runtime_in_sec == 0 and self.max_iterations == 0:
  55. raise RuntimeError(
  56. "Either 'max_runtime_in_sec' or 'max_iterations' must not be 0"
  57. )