mzcompose.py 1.4 KB

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