Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker-java to 3.0.12 #393

Merged
merged 5 commits into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ 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)

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

## [1.3.1] - 2017-06-22
### Fixed
Expand Down
11 changes: 0 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 @@ -57,12 +52,6 @@
<version>2.0.1</version>
</dependency>

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At last this can die 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It served a great job! 🥇 :)


<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-exec</artifactId>
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still find these priorities a little hard to grok - you kind of need to jump around from class to class to figure out what the sorted order will be.
Not now, but please could we reconsider moving back to having this ordering defined in one place?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Since we remember last used strategy, I think we can remove them now. Will do as a follow up

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, but can we actually do that? For example, I would like Docker-for-Mac/Win to always come before Docker Machine. That way users at least have a chance to control which gets used from the outside (they can quit DfM and docker-machine gets used as a fallback). Similarly for setting env vars to force use of a particular docker daemon.

This might need some care 🤔...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had to remove ~/.testcontainers.properties a couple of times because it saved Docker Machine strategy when Docker for Mac was turned off :)

Maybe we can mark Docker Machine strategy as non-persistable, so that it will be used only as a fallback?
IMO it makes sense to do that in 2017 :D


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