mzcompose.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. Various ways of putting simulated secret data into Materialize, make sure it doesn't end up in any logs.
  11. """
  12. import glob
  13. from materialize import MZ_ROOT, buildkite
  14. from materialize.mzcompose.composition import Composition, WorkflowArgumentParser
  15. from materialize.mzcompose.services.azurite import Azurite
  16. from materialize.mzcompose.services.fivetran_destination import FivetranDestination
  17. from materialize.mzcompose.services.kafka import Kafka
  18. from materialize.mzcompose.services.materialized import Materialized
  19. from materialize.mzcompose.services.minio import Minio
  20. from materialize.mzcompose.services.mysql import MySql
  21. from materialize.mzcompose.services.mz import Mz
  22. from materialize.mzcompose.services.postgres import Postgres
  23. from materialize.mzcompose.services.redpanda import Redpanda
  24. from materialize.mzcompose.services.schema_registry import SchemaRegistry
  25. from materialize.mzcompose.services.testdrive import Testdrive
  26. from materialize.mzcompose.services.zookeeper import Zookeeper
  27. SERVICES = [
  28. Zookeeper(),
  29. Kafka(),
  30. SchemaRegistry(),
  31. Redpanda(),
  32. Postgres(),
  33. MySql(),
  34. Azurite(),
  35. Mz(app_password=""),
  36. Minio(setup_materialize=True, additional_directories=["copytos3"]),
  37. Materialized(),
  38. FivetranDestination(volumes_extra=["tmp:/share/tmp"]),
  39. Testdrive(),
  40. ]
  41. def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
  42. """Run testdrive."""
  43. parser.add_argument(
  44. "files",
  45. nargs="*",
  46. default=["*.td"],
  47. help="run against the specified files",
  48. )
  49. (args, passthrough_args) = parser.parse_known_args()
  50. dependencies = [
  51. "fivetran-destination",
  52. "materialized",
  53. "postgres",
  54. "mysql",
  55. "minio",
  56. "zookeeper",
  57. "kafka",
  58. "schema-registry",
  59. ]
  60. c.up(*dependencies)
  61. def process(file: str) -> None:
  62. c.run_testdrive_files(
  63. f"--var=mysql-root-password={MySql.DEFAULT_ROOT_PASSWORD}",
  64. *passthrough_args,
  65. file,
  66. quiet=True, # Don't print out the secret here
  67. )
  68. files = buildkite.shard_list(
  69. sorted(
  70. [
  71. file
  72. for pattern in args.files
  73. for file in glob.glob(
  74. pattern, root_dir=MZ_ROOT / "test" / "secrets-logging"
  75. )
  76. ]
  77. ),
  78. lambda file: file,
  79. )
  80. c.test_parts(files, process)
  81. c.sanity_restart_mz()