Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ script:
-w "$(pwd)" \
openjdk:8-jre \
./mvnw -B -pl core test -Dtest=*GenericContainerRuleTest
# Run Docker-in-Docker tests inside Alpine
- |
DOCKER_HOST=unix:///var/run/docker.sock DOCKER_TLS_VERIFY= docker run --rm \
-v "$HOME/.m2":/root/.m2/ \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)":"$(pwd)" \
-w "$(pwd)" \
kiview/openjdk-alpine-bash:8u111 \
./mvnw -B -pl core test -Dtest=*GenericContainerRuleTest
- mvn -B test -f shade-test/pom.xml

cache:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class DockerClientFactory {

private static final List<DockerClientProviderStrategy> CONFIGURATION_STRATEGIES =
asList(new EnvironmentAndSystemPropertyClientProviderStrategy(),
new ProxiedUnixSocketClientProviderStrategy(),
new UnixSocketClientProviderStrategy(),
new ProxiedUnixSocketClientProviderStrategy(),
new DockerMachineClientProviderStrategy());
private String activeApiVersion;
private String activeExecutionDriver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void waitUntilReady() {
Callable<Boolean> checkStrategy;

// Special case for Docker for Mac, see #160
if (DockerClientFactory.instance().isUsing(ProxiedUnixSocketClientProviderStrategy.class)) {
if (isUsingSocketProxyOnMac()) {
List<Integer> exposedPorts = container.getExposedPorts();

Integer exposedPort = exposedPorts.stream()
Expand Down Expand Up @@ -90,4 +90,9 @@ protected void waitUntilReady() {
container.getContainerIpAddress() + ":" + port + " should be listening)");
}
}

private boolean isUsingSocketProxyOnMac() {
return DockerClientFactory.instance().isUsing(ProxiedUnixSocketClientProviderStrategy.class)
&& System.getProperty("os.name").toLowerCase().contains("mac");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void test() throws InvalidConfigurationException {

final int timeout = Integer.parseInt(System.getProperty(PING_TIMEOUT_PROPERTY_NAME, PING_TIMEOUT_DEFAULT));
ping(client, timeout);
} catch (Exception e) {
} catch (Exception | UnsatisfiedLinkError e) {
LOGGER.error("ping failed with configuration {} due to {}", getDescription(), e.toString(), e);
throw new InvalidConfigurationException("ping failed");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ public class ProxiedUnixSocketClientProviderStrategy extends UnixSocketClientPro
@Override
public void test() throws InvalidConfigurationException {

if (!System.getProperty("os.name").toLowerCase().contains("mac")) {
throw new InvalidConfigurationException("this strategy is only applicable to OS X");
String osName = System.getProperty("os.name").toLowerCase();
if (!osName.contains("mac") && !osName.contains("linux")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we even have to check?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We could switch logic and check for Windows.

throw new InvalidConfigurationException("this strategy is only applicable to OS X and Linux");
}

TcpToUnixSocketProxy proxy = new TcpToUnixSocketProxy(new File(DOCKER_SOCK_PATH));
Expand All @@ -20,7 +21,7 @@ public void test() throws InvalidConfigurationException {

config = tryConfiguration("tcp://localhost:" + proxyPort);

LOGGER.info("Accessing Docker for Mac unix domain socket via TCP proxy (" + DOCKER_SOCK_PATH + " via localhost:" + proxyPort + ")");
LOGGER.info("Accessing unix domain socket via TCP proxy (" + DOCKER_SOCK_PATH + " via localhost:" + proxyPort + ")");
} catch (Exception e) {

proxy.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void test()
try {
config = tryConfiguration(SOCKET_LOCATION);
LOGGER.info("Accessing docker with local Unix socket");
} catch (Exception e) {
} catch (Exception | UnsatisfiedLinkError e) {
throw new InvalidConfigurationException("ping failed", e);
}
}
Expand Down