@@ -53,17 +53,20 @@ public class DebeziumIT {
5353 @ RegisterExtension
5454 public static JarResolverExtension questdbJarResolver = JarResolverExtension .forClass (Sender .class );
5555
56- private static Network network = Network .newNetwork ();
56+ private static final Network network = Network .newNetwork ();
5757
58- private static KafkaContainer kafkaContainer = new KafkaContainer ()
58+ @ Container
59+ private final KafkaContainer kafkaContainer = new KafkaContainer (DockerImageName .parse ("confluentinc/cp-kafka:7.2.2" ))
5960 .withNetwork (network );
6061
61- public static PostgreSQLContainer <?> postgresContainer =
62- new PostgreSQLContainer <>(DockerImageName .parse ("debezium/postgres:11" ).asCompatibleSubstituteFor ("postgres" ))
62+ @ Container
63+ public PostgreSQLContainer <?> postgresContainer =
64+ new PostgreSQLContainer <>(DockerImageName .parse ("debezium/postgres:11-alpine" ).asCompatibleSubstituteFor ("postgres" ))
6365 .withNetwork (network )
6466 .withNetworkAliases ("postgres" );
6567
66- public static DebeziumContainer debeziumContainer =
68+ @ Container
69+ public DebeziumContainer debeziumContainer =
6770 new DebeziumContainer ("debezium/connect:1.9.6.Final" )
6871 .withNetwork (network )
6972 .withKafka (kafkaContainer )
@@ -75,30 +78,15 @@ public class DebeziumIT {
7578 .withEnv ("CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE" , "true" );
7679
7780 @ Container
78- private static final GenericContainer <?> questDBContainer = new GenericContainer <>("questdb/questdb:6.5.3" )
81+ private final GenericContainer <?> questDBContainer = new GenericContainer <>("questdb/questdb:6.5.3" )
7982 .withNetwork (network )
8083 .withExposedPorts (QuestDBUtils .QUESTDB_HTTP_PORT )
8184 .withLogConsumer (new Slf4jLogConsumer (LoggerFactory .getLogger ("questdb" )))
8285 .withEnv ("QDB_CAIRO_COMMIT_LAG" , "100" )
8386 .withEnv ("JAVA_OPTS" , "-Djava.locale.providers=JRE,SPI" );
8487
85- @ BeforeAll
86- public static void startContainers () {
87- Startables .deepStart (Stream .of (
88- kafkaContainer , postgresContainer , debeziumContainer ))
89- .join ();
90- }
91-
92- @ AfterEach
93- public void cleanup () throws SQLException {
94- debeziumContainer .deleteAllConnectors ();
95- try (Connection connection = getConnection (postgresContainer );
96- Statement statement = connection .createStatement ()) {
97- statement .execute ("drop schema " + PG_SCHEMA_NAME + " CASCADE" );
98- }
99- }
10088
101- private static ConnectorConfiguration newQuestSinkBaseConfig (String questTableName ) {
89+ private ConnectorConfiguration newQuestSinkBaseConfig (String questTableName ) {
10290 ConnectorConfiguration questSink = ConnectorConfiguration .create ()
10391 .with ("connector.class" , QuestDBSinkConnector .class .getName ())
10492 .with ("host" , questDBContainer .getNetworkAliases ().get (0 ))
@@ -418,7 +406,7 @@ public void testDelete() throws SQLException {
418406 }
419407 }
420408
421- private static void startDebeziumConnector () {
409+ private void startDebeziumConnector () {
422410 ConnectorConfiguration connector = ConnectorConfiguration
423411 .forJdbcContainer (postgresContainer )
424412 .with ("database.server.name" , PG_SERVER_NAME );
0 commit comments