tet123/debezium-connector-postgres/pom.xml
Vojtech Juranek e1b65cd6f7 DBZ-5889 Run integration tests in specified order
Run the tests alwyas in thr same order to make it more easy to debug
failures. If needed, the order can be changed (e.g. to `random`) by
overriding propeperty `runOrder`.
2022-12-08 13:00:41 +01:00

465 lines
19 KiB
XML

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.debezium</groupId>
<artifactId>debezium-parent</artifactId>
<version>2.1.0-SNAPSHOT</version>
<relativePath>../debezium-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>debezium-connector-postgres</artifactId>
<name>Debezium Connector for PostgreSQL</name>
<packaging>jar</packaging>
<properties>
<!--
Specify the properties that will be used for setting up the integration tests' Docker container.
Note that the `dockerhost.ip` property is computed from the IP address of DOCKER_HOST, which will
work on all platforms. We'll set some of these as system properties during integration testing.
-->
<version.postgres.server>10</version.postgres.server>
<postgres.host>${docker.host.address}</postgres.host>
<postgres.port>5432</postgres.port>
<postgres.user>postgres</postgres.user>
<postgres.password>postgres</postgres.password>
<postgres.db.name>postgres</postgres.db.name>
<postgres.encoding>UTF8</postgres.encoding>
<postgres.system.lang>en_US.utf8</postgres.system.lang>
<postgres.image>debezium/postgres:${version.postgres.server}</postgres.image>
<postgres.config.file>/usr/share/postgresql/postgresql.conf.sample</postgres.config.file>
<docker.skip>false</docker.skip>
<docker.showLogs>true</docker.showLogs>
<docker.initimage>ln -fs /usr/share/zoneinfo/US/Samoa /etc/localtime &amp;&amp; echo timezone=US/Samoa &gt;&gt; ${postgres.config.file}</docker.initimage>
<docker.dbs>debezium/postgres-server-test-database</docker.dbs>
<docker.filter>${docker.dbs}</docker.filter>
<protobuf.output.directory>${project.basedir}/generated-sources</protobuf.output.directory>
<!-- We're tracking the API changes of the SPI. -->
<revapi.skip>false</revapi.skip>
<!-- Apicurion container properties -->
<apicurio.port>8080</apicurio.port>
<apicurio.init.timeout>60000</apicurio.init.timeout> <!-- 60 seconds -->
</properties>
<dependencies>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-core</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>connect-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-embedded</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-embedded</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-connect-avro-converter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<protocVersion>${version.com.google.protobuf}</protocVersion> <!-- 2.4.1, 2.5.0, 2.6.1, 3.0.0 -->
<outputDirectory>${protobuf.output.directory}</outputDirectory>
<inputDirectories>
<include>src/main/proto</include>
</inputDirectories>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<watchInterval>500</watchInterval>
<logDate>default</logDate>
<verbose>true</verbose>
<images>
<image>
<!-- A Docker image using the Postgres Server with the DBZ decoderbufs plugin -->
<name>debezium/postgres-server-test-database</name>
<run>
<namingStrategy>none</namingStrategy>
<env>
<POSTGRES_USER>${postgres.user}</POSTGRES_USER>
<POSTGRES_PASSWORD>${postgres.password}</POSTGRES_PASSWORD>
<POSTGRES_DB>${postgres.db.name}</POSTGRES_DB>
<POSTGRES_INITDB_ARGS>-E ${postgres.encoding}</POSTGRES_INITDB_ARGS>
<LANG>${postgres.system.lang}</LANG>
</env>
<ports>
<port>${postgres.port}:5432</port>
</ports>
<log>
<prefix>postgres</prefix>
<enabled>true</enabled>
<color>yellow</color>
</log>
<wait>
<time>30000</time> <!-- 30 seconds max -->
<log>(?s)PostgreSQL init process complete.*database system is ready to accept connections</log>
</wait>
</run>
<build>
<from>${postgres.image}</from>
<runCmds>
<run>${docker.initimage}</run>
</runCmds>
</build>
<external>
<type>properties</type>
<mode>override</mode>
</external>
</image>
<image>
<name>apicurio/apicurio-registry-mem:${version.apicurio}</name>
<run>
<namingStrategy>none</namingStrategy>
<ports>
<port>${apicurio.port}:8080</port>
</ports>
<log>
<prefix>apicurio</prefix>
<enabled>true</enabled>
<color>blue</color>
</log>
<wait>
<log>.*apicurio-registry-app.*started in.*</log>
<time>${apicurio.init.timeout}</time>
</wait>
</run>
</image>
</images>
</configuration>
<!--
Connect this plugin to the maven lifecycle around the integration-test phase:
start the container in pre-integration-test and stop it in post-integration-test.
-->
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
Unlike surefire, the failsafe plugin ensures 'post-integration-test' phase always runs, even
when there are failed integration tests. We rely upon this to always shut down the Docker container
after the integration tests (defined as '*IT.java') are run.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<skipTests>${skipITs}</skipTests>
<enableAssertions>true</enableAssertions>
<systemPropertyVariables>
<!-- Make these available to the tests via system properties -->
<database.hostname>${postgres.host}</database.hostname>
<database.port>${postgres.port}</database.port>
<database.user>${postgres.user}</database.user>
<database.password>${postgres.password}</database.password>
<database.dbname>${postgres.db.name}</database.dbname>
<plugin.name>${decoder.plugin.name}</plugin.name>
<skipLongRunningTests>${skipLongRunningTests}</skipLongRunningTests>
</systemPropertyVariables>
<runOrder>${runOrder}</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>io.debezium</groupId>
<artifactId>debezium-schema-generator</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>generate-connector-metadata</id>
<goals>
<goal>generate-api-spec</goal>
</goals>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<!-- Apply the properties set in the POM to the resource files -->
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>*</include>
<include>**/*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<includes>
<include>*</include>
<include>**/*</include>
</includes>
</testResource>
</testResources>
</build>
<!--
Define several useful profiles
-->
<profiles>
<profile>
<id>assembly</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${version.assembly.plugin}</version>
<dependencies>
<dependency>
<groupId>io.debezium</groupId>
<artifactId>debezium-assembly-descriptors</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>default</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<attach>true</attach> <!-- we want attach & deploy these to Maven -->
<descriptorRefs>
<descriptorRef>${assembly.descriptor}</descriptorRef>
</descriptorRefs>
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>qa</id>
<activation>
<property>
<name>!quick</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.revapi</groupId>
<artifactId>revapi-maven-plugin</artifactId>
<configuration>
<analysisConfiguration combine.children="append">
<revapi.java>
<filter>
<packages>
<include>
<item>io.debezium.connector.postgresql.spi</item>
</include>
</packages>
</filter>
</revapi.java>
</analysisConfiguration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>quick</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>quick</name>
</property>
</activation>
<properties>
<skipITs>true</skipITs>
<docker.skip>true</docker.skip>
</properties>
</profile>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do not perform any Docker-related functionality
To use, specify "-DskipITs" on the Maven command line.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<profile>
<id>skip-integration-tests</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>skipITs</name>
</property>
</activation>
<properties>
<docker.skip>true</docker.skip>
</properties>
</profile>
<profile>
<id>postgres-10</id>
<properties>
<version.postgres.server>10</version.postgres.server>
</properties>
</profile>
<profile>
<id>postgres-14</id>
<properties>
<version.postgres.server>14</version.postgres.server>
</properties>
</profile>
<profile>
<id>postgres-15</id>
<properties>
<version.postgres.server>15</version.postgres.server>
</properties>
</profile>
<profile>
<id>pgoutput-decoder</id>
<properties>
<decoder.plugin.name>pgoutput</decoder.plugin.name>
</properties>
</profile>
<profile>
<id>charset-8bit</id>
<properties>
<postgres.system.lang>${cs_CZ.iso-8859-2}</postgres.system.lang>
<postgres.encoding>LATIN2</postgres.encoding>
</properties>
</profile>
<profile>
<id>apicurio</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>apicurio</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<use.apicurio>true</use.apicurio>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<docker.filter>${docker.dbs},apicurio/apicurio-registry-mem:${version.apicurio}</docker.filter>
</properties>
</profile>
</profiles>
</project>