# Copyright Materialize, Inc. and contributors. All rights reserved. # # Use of this software is governed by the Business Source License # included in the LICENSE file at the root of this repository. # # As of the Change Date specified in that file, in accordance with # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0. # # Note that this file is *not* reentrant. Neither Postgres nor # Debezium allow error-free dropping of objects (users or connectors) # that may or may not exist using the same set of commands for all # cases. # # Furthermore, doing a couple of REST calls against the same Debezium # connector is an easy way to bork it, so please always do # # ./mzcompose -down v # # before running this test framework again. # # # Configure the Postgres side # # we could use postgres:postgres as our Debezium user, however our # documentation suggests the creation of a dedicated user, so # we do the same in the test. # $ postgres-execute connection=postgres://postgres:postgres@postgres CREATE USER debezium WITH SUPERUSER PASSWORD 'debezium'; GRANT ALL PRIVILEGES ON DATABASE "postgres" TO debezium; GRANT ALL PRIVILEGES ON SCHEMA "public" TO debezium; # # Configure the Debezium side # $ http-request method=POST url=http://debezium:8083/connectors content-type=application/json { "name": "psql-connector", "config": { "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "database.hostname": "postgres", "database.port": "5432", "database.user": "debezium", "database.password": "debezium", "database.dbname" : "postgres", "database.server.name": "postgres", "plugin.name": "pgoutput", "slot.name" : "tester", "database.history.kafka.bootstrap.servers": "kafka:9092", "database.history.kafka.topic": "schema-changes.history", "truncate.handling.mode": "include", "decimal.handling.mode": "precise", "topic.prefix": "postgres" } } # Increase table and source limit because the Postgres test tends to create a lot of tables and sources $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr} ALTER SYSTEM SET max_tables = 1000 ALTER SYSTEM SET max_sources = 1000 # Sleep for 10 seconds, as Debezium may fail to replicate any # postgresql statements that come immediately afterwards $ sleep-is-probably-flaky-i-have-justified-my-need-with-a-comment duration="10s"