Skip to content

Commit 119857b

Browse files
committed
tests: add support for integration tests
Initial scaffolding to provide a place where we can write tests that have a dependency on a running MQ queue manager. Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
1 parent 16263a9 commit 119857b

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ Change directory into the `kafka-connect-mq-sink` directory:
3737
cd kafka-connect-mq-sink
3838
```
3939

40+
Run the unit tests:
41+
```shell
42+
mvn test
43+
```
44+
45+
Run the integration tests (requires Docker):
46+
```shell
47+
mvn integration-test
48+
```
49+
4050
Build the connector using Maven:
4151
```shell
4252
mvn clean package

pom.xml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@
7878
<version>1.7.25</version>
7979
<scope>test</scope>
8080
</dependency>
81+
82+
<!-- tests in src/integration depend on a running MQ queue manager -->
83+
<!-- in a container, configured using org.testcontainers -->
84+
<dependency>
85+
<groupId>org.testcontainers</groupId>
86+
<artifactId>testcontainers</artifactId>
87+
<version>1.17.2</version>
88+
<scope>test</scope>
89+
</dependency>
8190
</dependencies>
8291

8392
<build>
@@ -92,13 +101,31 @@
92101
</plugin>
93102
<plugin>
94103
<artifactId>maven-surefire-plugin</artifactId>
95-
<version>3.0.0-M1</version>
104+
<version>3.0.0-M7</version>
96105
<configuration>
97106
<systemPropertyVariables>
98107
<connectorVersion>${project.version}</connectorVersion>
99108
</systemPropertyVariables>
100109
</configuration>
101110
</plugin>
111+
<plugin>
112+
<artifactId>maven-failsafe-plugin</artifactId>
113+
<version>3.0.0-M7</version>
114+
<configuration>
115+
<systemPropertyVariables>
116+
<connectorVersion>${project.version}</connectorVersion>
117+
</systemPropertyVariables>
118+
</configuration>
119+
<executions>
120+
<execution>
121+
<id>integration-tests</id>
122+
<goals>
123+
<goal>integration-test</goal>
124+
<goal>verify</goal>
125+
</goals>
126+
</execution>
127+
</executions>
128+
</plugin>
102129
<plugin>
103130
<artifactId>maven-assembly-plugin</artifactId>
104131
<version>3.1.1</version>
@@ -116,6 +143,30 @@
116143
</descriptors>
117144
</configuration>
118145
</plugin>
146+
147+
148+
<!-- add the src/integration folder as a test folder, which lets us keep -->
149+
<!-- tests that have a dependency on testcontainers separate from pure -->
150+
<!-- unit tests with no external dependency -->
151+
<plugin>
152+
<groupId>org.codehaus.mojo</groupId>
153+
<artifactId>build-helper-maven-plugin</artifactId>
154+
<version>3.3.0</version>
155+
<executions>
156+
<execution>
157+
<id>add-test-source</id>
158+
<phase>process-test-sources</phase>
159+
<goals>
160+
<goal>add-test-source</goal>
161+
</goals>
162+
<configuration>
163+
<sources>
164+
<source>src/integration/java</source>
165+
</sources>
166+
</configuration>
167+
</execution>
168+
</executions>
169+
</plugin>
119170
</plugins>
120171
</build>
121172
</project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.ibm.eventstreams.connect.mqsink;
2+
3+
import static org.junit.Assert.assertEquals;
4+
5+
import org.junit.Test;
6+
7+
public class PlaceholderIntegrationIT {
8+
9+
@Test
10+
public void testMavenConfig() {
11+
assertEquals("verify maven config", "yes", "yes");
12+
}
13+
14+
}

0 commit comments

Comments
 (0)