Skip to content

Commit 1301d5e

Browse files
committed
Merge pull request #79 from albers/integration-tests
Move slow tests to integration test phase, enable tests by default
2 parents ef33c69 + 843600d commit 1301d5e

26 files changed

+64
-16
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ Developer forum for [docker-java](https://groups.google.com/forum/?hl=de#!forum/
1616
* Maven 3.0.5
1717
* Docker daemon running
1818

19-
Maven may run tests during build process but tests are disabled by default. The tests are using a localhost instance of Docker, make sure that you have Docker running for tests to work. To run the tests you have to provide your https://www.docker.io/account/login/ information:
19+
The Maven build includes integration tests which are using a localhost instance of Docker and require manual setup. Make sure you have a local Docker daemon running and then provide your https://registry.hub.docker.com/account/login/ information via system properties:
2020

21-
$ mvn clean install -DskipTests=false -Ddocker.io.username=... -Ddocker.io.password=... -Ddocker.io.email=...
21+
$ mvn clean install -Ddocker.io.username=... -Ddocker.io.password=... -Ddocker.io.email=...
22+
23+
_If your Docker server is remote, add its URL like this: `-Ddocker.io.url=http://...:2375`._
24+
25+
If you do not have access to a Docker server or just want to execute the build quickly, you can run the build without the integration tests:
26+
27+
$ mvn clean install -DskipITs
2228

2329
By default Docker server is using UNIX sockets for communication with the Docker client, however docker-java
2430
client uses TCP/IP to connect to the Docker server, so you will need to make sure that your Docker server is

pom.xml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@
4040
</developers>
4141

4242
<properties>
43-
<skipTests>true</skipTests>
44-
4543
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
44+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
4645
<jdk.debug>true</jdk.debug>
4746
<jdk.optimize>false</jdk.optimize>
4847
<jdk.source>1.6</jdk.source>
@@ -76,7 +75,8 @@
7675
<maven-jar-plugin.version>2.2</maven-jar-plugin.version>
7776
<maven-compiler-plugin.version>2.3.1</maven-compiler-plugin.version>
7877
<maven-release-plugin.version>2.3.1</maven-release-plugin.version>
79-
<maven-surefire-plugin.version>2.8.1</maven-surefire-plugin.version>
78+
<maven-surefire-plugin.version>2.17</maven-surefire-plugin.version>
79+
<maven-failsafe-plugin.version>2.17</maven-failsafe-plugin.version>
8080
<cobertura-maven-plugin.version>2.5.1</cobertura-maven-plugin.version>
8181
<maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
8282
</properties>
@@ -255,16 +255,6 @@
255255
</executions>
256256
</plugin>
257257

258-
<plugin>
259-
<groupId>org.apache.maven.plugins</groupId>
260-
<artifactId>maven-surefire-plugin</artifactId>
261-
<version>${maven-surefire-plugin.version}</version>
262-
<configuration>
263-
<skipTests>${skipTests}</skipTests>
264-
</configuration>
265-
</plugin>
266-
267-
268258
<plugin>
269259
<groupId>org.codehaus.mojo</groupId>
270260
<artifactId>cobertura-maven-plugin</artifactId>
@@ -329,6 +319,35 @@
329319
<goals>deploy nexus-staging:release</goals>
330320
</configuration>
331321
</plugin>
322+
323+
<plugin>
324+
<groupId>org.apache.maven.plugins</groupId>
325+
<artifactId>maven-surefire-plugin</artifactId>
326+
<version>${maven-surefire-plugin.version}</version>
327+
<configuration>
328+
<excludedGroups>integration</excludedGroups>
329+
</configuration>
330+
</plugin>
331+
332+
<plugin>
333+
<groupId>org.apache.maven.plugins</groupId>
334+
<artifactId>maven-failsafe-plugin</artifactId>
335+
<version>${maven-failsafe-plugin.version}</version>
336+
<executions>
337+
<execution>
338+
<goals>
339+
<goal>integration-test</goal>
340+
<goal>verify</goal>
341+
</goals>
342+
<configuration>
343+
<groups>integration</groups>
344+
<includes>
345+
<include>**/*Test.java</include>
346+
</includes>
347+
</configuration>
348+
</execution>
349+
</executions>
350+
</plugin>
332351
</plugins>
333352
</build>
334353

src/test/java/com/github/dockerjava/client/DockerClientTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
* @author Konstantin Pelykh (kpelykh@gmail.com)
2424
*/
25+
@Test(groups = "integration")
2526
public class DockerClientTest extends AbstractDockerClientTest {
2627
public static final Logger LOG = LoggerFactory
2728
.getLogger(DockerClientTest.class);

src/test/java/com/github/dockerjava/core/command/AuthCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.github.dockerjava.core.DockerClientBuilder;
1717
import com.github.dockerjava.core.DockerClientConfig;
1818

19+
@Test(groups = "integration")
1920
public class AuthCmdImplTest extends AbstractDockerClientTest {
2021

2122
@BeforeTest

src/test/java/com/github/dockerjava/core/command/BuildImageCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.github.dockerjava.api.command.InspectImageResponse;
2929
import com.github.dockerjava.client.AbstractDockerClientTest;
3030

31+
@Test(groups = "integration")
3132
public class BuildImageCmdImplTest extends AbstractDockerClientTest {
3233

3334
@BeforeTest

src/test/java/com/github/dockerjava/core/command/CommitCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.github.dockerjava.api.command.InspectImageResponse;
2323
import com.github.dockerjava.client.AbstractDockerClientTest;
2424

25+
@Test(groups = "integration")
2526
public class CommitCmdImplTest extends AbstractDockerClientTest {
2627

2728
@BeforeTest

src/test/java/com/github/dockerjava/core/command/ContainerDiffCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.github.dockerjava.api.model.ChangeLog;
2424
import com.github.dockerjava.client.AbstractDockerClientTest;
2525

26+
@Test(groups = "integration")
2627
public class ContainerDiffCmdImplTest extends AbstractDockerClientTest {
2728

2829
@BeforeTest

src/test/java/com/github/dockerjava/core/command/CopyFileFromContainerCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static org.hamcrest.Matchers.*;
1414
import static org.hamcrest.MatcherAssert.assertThat;
1515

16+
@Test(groups = "integration")
1617
public class CopyFileFromContainerCmdImplTest extends AbstractDockerClientTest {
1718

1819
@BeforeTest

src/test/java/com/github/dockerjava/core/command/CreateContainerCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.github.dockerjava.api.model.Volume;
2222
import com.github.dockerjava.client.AbstractDockerClientTest;
2323

24+
@Test(groups = "integration")
2425
public class CreateContainerCmdImplTest extends AbstractDockerClientTest {
2526

2627
@BeforeTest

src/test/java/com/github/dockerjava/core/command/EventsCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.concurrent.ExecutorService;
2121
import java.util.concurrent.TimeUnit;
2222

23+
@Test(groups = "integration")
2324
public class EventsCmdImplTest extends AbstractDockerClientTest {
2425

2526
private static int KNOWN_NUM_EVENTS = 4;

0 commit comments

Comments
 (0)