mzcompose.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. """
  10. Functional test for MySQL source with real-time recency enabled. Queries should
  11. block until results are available instead of returning out of date results.
  12. """
  13. import random
  14. from materialize.mzcompose.composition import Composition
  15. from materialize.mzcompose.services.materialized import Materialized
  16. from materialize.mzcompose.services.mysql import MySql
  17. from materialize.mzcompose.services.testdrive import Testdrive
  18. from materialize.mzcompose.services.toxiproxy import Toxiproxy
  19. SERVICES = [
  20. MySql(),
  21. Materialized(default_replication_factor=2),
  22. Toxiproxy(),
  23. Testdrive(
  24. entrypoint_extra=[
  25. f"--var=mysql-root-password={MySql.DEFAULT_ROOT_PASSWORD}",
  26. ],
  27. ),
  28. ]
  29. #
  30. # Test that real-time recency works w/ slow ingest of upstream data.
  31. #
  32. def workflow_default(c: Composition) -> None:
  33. c.up("mysql", "materialized", "toxiproxy")
  34. seed = random.getrandbits(16)
  35. c.run_testdrive_files(
  36. "--no-reset",
  37. "--max-errors=1",
  38. f"--seed={seed}",
  39. "rtr/toxiproxy-setup.td",
  40. "rtr/mz-setup.td",
  41. "rtr/verify-rtr.td",
  42. )