mzcompose.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.mzcompose.composition import Composition
  10. from materialize.mzcompose.services.kafka import Kafka
  11. from materialize.mzcompose.services.materialized import Materialized
  12. from materialize.mzcompose.services.minio import Minio
  13. from materialize.mzcompose.services.mz import Mz
  14. from materialize.mzcompose.services.schema_registry import SchemaRegistry
  15. from materialize.mzcompose.services.testdrive import Testdrive
  16. from materialize.mzcompose.services.zookeeper import Zookeeper
  17. versioned_mz = [
  18. Materialized(
  19. name=f"materialized_{version}",
  20. image=f"materialize/materialized:{version}",
  21. )
  22. for version in ["v0.7.0", "v0.8.0"]
  23. ]
  24. mz_with_options = [
  25. Materialized(name="mz_2_workers"),
  26. Materialized(name="mz_4_workers"),
  27. ]
  28. SERVICES = [
  29. Minio(setup_materialize=True),
  30. Zookeeper(),
  31. Kafka(),
  32. SchemaRegistry(),
  33. *versioned_mz,
  34. *mz_with_options,
  35. Testdrive(),
  36. Mz(app_password=""),
  37. ]
  38. def workflow_default(c: Composition) -> None:
  39. """All mzcompose files should contain a default workflow
  40. This workflow just runs all the other ones
  41. """
  42. def process(name: str) -> None:
  43. if name == "default":
  44. return
  45. with c.test_case(name):
  46. c.workflow(name)
  47. c.test_parts(list(c.workflows.keys()), process)
  48. def workflow_start_confluents(c: Composition) -> None:
  49. c.up("zookeeper", "kafka", "schema-registry")
  50. def workflow_versioned_mz(c: Composition) -> None:
  51. for mz in versioned_mz:
  52. c.up(mz.name)
  53. c.run_testdrive_files("test*.td")
  54. c.kill(mz.name)
  55. def workflow_mz_with_options(c: Composition) -> None:
  56. c.up("mz_2_workers")
  57. c.kill("mz_2_workers")
  58. c.up("mz_4_workers")
  59. c.kill("mz_4_workers")
  60. def workflow_minio(c: Composition) -> None:
  61. mz = Materialized(external_blob_store=True)
  62. with c.override(mz):
  63. c.up("materialized")