-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use unix socket proxy on OS X instead of netty KQueue route (#410)
Adjust docker client provider strategies so that a proxied (TCP) connection is used to connect to the Docker daemon on < OS X 10.12. Fixes #402.
- Loading branch information
Showing
11 changed files
with
98 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...rc/main/java/org/testcontainers/dockerclient/ProxiedUnixSocketClientProviderStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.testcontainers.dockerclient; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.lang.SystemUtils; | ||
import org.rnorth.tcpunixsocketproxy.TcpToUnixSocketProxy; | ||
import org.testcontainers.utility.ComparableVersion; | ||
|
||
import java.io.File; | ||
|
||
@Slf4j | ||
public class ProxiedUnixSocketClientProviderStrategy extends UnixSocketClientProviderStrategy { | ||
|
||
public static final int PRIORITY = EnvironmentAndSystemPropertyClientProviderStrategy.PRIORITY - 10; | ||
|
||
private final File socketFile = new File(DOCKER_SOCK_PATH); | ||
|
||
@Override | ||
protected boolean isApplicable() { | ||
final boolean nettyDoesNotSupportMacUnixSockets = SystemUtils.IS_OS_MAC_OSX && | ||
ComparableVersion.OS_VERSION.isLessThan("10.12"); | ||
|
||
return nettyDoesNotSupportMacUnixSockets && socketFile.exists(); | ||
} | ||
|
||
@Override | ||
protected int getPriority() { | ||
return PRIORITY; | ||
} | ||
|
||
@Override | ||
public void test() throws InvalidConfigurationException { | ||
TcpToUnixSocketProxy proxy = new TcpToUnixSocketProxy(socketFile); | ||
|
||
try { | ||
int proxyPort = proxy.start().getPort(); | ||
|
||
config = tryConfiguration("tcp://localhost:" + proxyPort); | ||
|
||
log.debug("Accessing unix domain socket via TCP proxy (" + DOCKER_SOCK_PATH + " via localhost:" + proxyPort + ")"); | ||
} catch (Exception e) { | ||
|
||
proxy.stop(); | ||
|
||
throw new InvalidConfigurationException("ping failed", e); | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "local Unix socket (via TCP proxy)"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
shade-test/jar-file/src/test/java/org/testcontainers/JarFileShadingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters