Skip to content

Commit

Permalink
Update docker-java to 3.0.12 (#393)
Browse files Browse the repository at this point in the history
* Update docker-java to 3.0.12.

Removes custom Netty factory and tcp-to-unixsocket proxy.

* changelog

* simplify UnixSocketClientProviderStrategy's condition

* shade kqueue native dependency
  • Loading branch information
bsideup authored Jul 7, 2017
1 parent a32e980 commit 3cce55a
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 126 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ All notable changes to this project will be documented in this file.
- Fixed erroneous version reference used during CI testing of shaded dependencies
- Fixed leakage of Vibur and Tomcat JDBC test dependencies in `jdbc-test` and `mysql` modules (#382)
- Added timeout and retries for creation of `RemoteWebDriver` (#381, #373, #257)
- Fixed double encoding of listNetwork's filter until it's fixed in docker-java (#385)
- Fixed various shading issues

### Changed
- Added support for Docker networks (#372)
- Added `getFirstMappedPort` method (#377)
- Extracted Oracle XE container into a separate repository ([testcontainers/testcontainers-java-module-oracle-xe](https://github.com/testcontainers/testcontainers-java-module-oracle-xe))
- Added shading tests
- Updated docker-java to 3.0.12 (#393)

## [1.3.1] - 2017-06-22
### Fixed
Expand Down
13 changes: 2 additions & 11 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
<version>${docker-java.version}</version>
<scope>compile</scope>
<exclusions>
<!-- replace with junixsocket -->
<exclusion>
<groupId>de.gesellix</groupId>
<artifactId>unix-socket-factory</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>*</artifactId>
Expand Down Expand Up @@ -61,12 +56,6 @@
<version>2.0.1</version>
</dependency>

<dependency>
<groupId>org.rnorth</groupId>
<artifactId>tcp-unix-socket-proxy</artifactId>
<version>1.0.1</version>
</dependency>

<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-exec</artifactId>
Expand Down Expand Up @@ -269,6 +258,8 @@
dest="${project.build.directory}/exploded/"/>
<move file="${project.build.directory}/exploded/META-INF/native/libnetty-transport-native-epoll.so"
tofile="${project.build.directory}/exploded/META-INF/native/liborg-testcontainers-shaded-netty-transport-native-epoll.so"/>
<move file="${project.build.directory}/exploded/META-INF/native/libnetty-transport-native-kqueue.jnilib"
tofile="${project.build.directory}/exploded/META-INF/native/liborg-testcontainers-shaded-netty-transport-native-kqueue.jnilib"/>
<jar destfile="${project.build.directory}/${project.artifactId}-${project.version}.jar"
basedir="${project.build.directory}/exploded"/>
</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class DockerClientFactory {
private static final List<DockerClientProviderStrategy> CONFIGURATION_STRATEGIES =
asList(new EnvironmentAndSystemPropertyClientProviderStrategy(),
new UnixSocketClientProviderStrategy(),
new ProxiedUnixSocketClientProviderStrategy(),
new DockerMachineClientProviderStrategy(),
new WindowsClientProviderStrategy());
private String activeApiVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.ContainerLaunchException;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.dockerclient.ProxiedUnixSocketClientProviderStrategy;
import org.testcontainers.dockerclient.DockerMachineClientProviderStrategy;
import org.testcontainers.dockerclient.WindowsClientProviderStrategy;

import java.net.Socket;
Expand Down Expand Up @@ -93,7 +93,7 @@ protected void waitUntilReady() {

private boolean shouldCheckWithCommand() {
// Special case for Docker for Mac, see #160
if(DockerClientFactory.instance().isUsing(ProxiedUnixSocketClientProviderStrategy.class)
if(!DockerClientFactory.instance().isUsing(DockerMachineClientProviderStrategy.class)
&& System.getProperty("os.name").toLowerCase().contains("mac")) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.core.DockerClientBuilder;
import com.github.dockerjava.core.DockerClientConfig;
import com.github.dockerjava.netty.NettyDockerCmdExecFactory;
import com.google.common.base.Throwables;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -141,7 +142,7 @@ public DockerClient getClient() {
protected DockerClient getClientForConfig(DockerClientConfig config) {
return DockerClientBuilder
.getInstance(config)
.withDockerCmdExecFactory(new TestcontainersDockerCmdExecFactory())
.withDockerCmdExecFactory(new NettyDockerCmdExecFactory())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
@Slf4j
public class DockerMachineClientProviderStrategy extends DockerClientProviderStrategy {

public static final int PRIORITY = EnvironmentAndSystemPropertyClientProviderStrategy.PRIORITY - 10;

private static final String PING_TIMEOUT_DEFAULT = "30";
private static final String PING_TIMEOUT_PROPERTY_NAME = "testcontainers.dockermachineprovider.timeout";

Expand All @@ -26,7 +29,7 @@ protected boolean isApplicable() {

@Override
protected int getPriority() {
return ProxiedUnixSocketClientProviderStrategy.PRIORITY - 10;
return PRIORITY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Slf4j
public class EnvironmentAndSystemPropertyClientProviderStrategy extends DockerClientProviderStrategy {

public static final int PRIORITY = 100;
public static final int PRIORITY = UnixSocketClientProviderStrategy.PRIORITY - 10;

private static final String PING_TIMEOUT_DEFAULT = "10";
private static final String PING_TIMEOUT_PROPERTY_NAME = "testcontainers.environmentprovider.timeout";
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
import org.apache.commons.lang.SystemUtils;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

@Slf4j
public class UnixSocketClientProviderStrategy extends DockerClientProviderStrategy {

public static final int PRIORITY = 100;

protected static final String DOCKER_SOCK_PATH = "/var/run/docker.sock";
private static final String SOCKET_LOCATION = "unix://" + DOCKER_SOCK_PATH;
private static final int SOCKET_FILE_MODE_MASK = 0xc000;
Expand All @@ -21,7 +25,12 @@ public class UnixSocketClientProviderStrategy extends DockerClientProviderStrate

@Override
protected boolean isApplicable() {
return SystemUtils.IS_OS_LINUX;
return SystemUtils.IS_OS_UNIX && new File(DOCKER_SOCK_PATH).exists();
}

@Override
protected int getPriority() {
return PRIORITY;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<docker-java.version>3.0.10</docker-java.version>
<docker-java.version>3.0.12</docker-java.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public void testMetaInf() throws Exception {
);

assertThatFileList(root.resolve("META-INF").resolve("native")).containsOnly(
"liborg-testcontainers-shaded-netty-transport-native-epoll.so"
"liborg-testcontainers-shaded-netty-transport-native-epoll.so",
"liborg-testcontainers-shaded-netty-transport-native-kqueue.jnilib"
);
}

Expand Down

0 comments on commit 3cce55a

Please sign in to comment.