Adar Dembo created KNOX-2007:
--------------------------------
Summary: TestHashicorpVaultAliasService fails if a process is
already bound to port 8200
Key: KNOX-2007
URL: https://issues.apache.org/jira/browse/KNOX-2007
Project: Apache Knox
Issue Type: Bug
Components: Tests
Affects Versions: 1.4.0
Reporter: Adar Dembo
{noformat}
$ git grep 8200
gateway-service-hashicorp-vault/src/test/java/org/apache/knox/gateway/backend/hashicorp/vault/TestHashicorpVaultAliasService.java:
private static final Integer vaultPort = 8200;
{noformat}
{noformat}
vaultAddress = String.format(Locale.ROOT,
"http://%s:%s",
vaultContainer.getContainerIpAddress(),
vaultContainer.getMappedPort(vaultPort));
{noformat}
{noformat}
/**
* Sets the Vault port in the container as well as the port bindings for
the host to reach the container over HTTP.
*
* @param port the port number you want to have the Vault container listen
on for tests.
* @return this
*/
public SELF withVaultPort(int port){
setVaultPortRequested(true);
String vaultPort = String.valueOf(port);
withEnv("VAULT_ADDR", "http://0.0.0.0:" + VAULT_PORT);
setPortBindings(Arrays.asList(vaultPort + ":" + VAULT_PORT));
return self();
}
{noformat}
{noformat}
$ sudo netstat -anp | grep 8200
tcp6 0 0 :::8200 :::* LISTEN
3291/docker-proxy
{noformat}
{noformat}
2019-09-04 16:07:02 INFO DockerClientProviderStrategy:179 - Will use 'okhttp'
transport
2019-09-04 16:07:03 INFO EnvironmentAndSystemPropertyClientProviderStrategy:48
- Found docker client settings from environment
2019-09-04 16:07:03 INFO DockerClientProviderStrategy:113 - Found Docker
environment with Environment variables, system properties and defaults.
Resolved:
dockerHost=unix:///var/run/docker.sock
apiVersion='{UNKNOWN_VERSION}'
registryUrl='https://index.docker.io/v1/'
registryUsername='adar'
registryPassword='null'
registryEmail='null'
dockerConfig='DefaultDockerClientConfig[dockerHost=unix:///var/run/docker.sock,registryUsername=adar,registryPassword=<null>,registryEmail=<null>,registryUrl=https://index.docker.io/v1/,dockerConfigPath=/home/adar/.docker,sslConfig=<null>,apiVersion={UNKNOWN_VERSION},dockerConfig=<null>]'
2019-09-04 16:07:03 INFO DockerClientFactory:108 - Docker host IP address is
localhost
2019-09-04 16:07:03 INFO DockerClientFactory:116 - Connected to docker:
Server Version: 18.09.7
API Version: 1.39
Operating System: Ubuntu 18.04.3 LTS
Total Memory: 32020 MB
2019-09-04 16:07:07 INFO DockerClientFactory:126 - Ryuk started - will monitor
and terminate Testcontainers containers on JVM exit
âšī¸ Checking the system...
â Docker version should be at least 1.6.0
â Docker environment should have more than 2GB free disk space
2019-09-04 16:07:07 INFO 3]:77 - Pulling docker image: vault:1.0.3. Please be
patient; this may take some time but only needs to be done once.
2019-09-04 16:07:12 INFO 3]:240 - Creating container for image: vault:1.0.3
2019-09-04 16:07:12 INFO 3]:252 - Starting container with ID:
5715b28d8fc37c9c134b87573bf7a4c244bc33772ff2d64e9aa56bbc8b755cc9
2019-09-04 16:07:12 ERROR 3]:278 - Could not start container
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy27.exec(Unknown Source)
at
org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:253)
at
org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:226)
at
org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
at
org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:224)
at
org.testcontainers.containers.GenericContainer.start(GenericContainer.java:213)
at
org.apache.knox.gateway.backend.hashicorp.vault.TestHashicorpVaultAliasService.setUpClass(TestHashicorpVaultAliasService.java:80)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
at
org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
at
org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
at
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
at
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: java.lang.reflect.InvocationTargetException
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at
org.testcontainers.dockerclient.AuditLoggingDockerClient.lambda$wrappedCommand$14(AuditLoggingDockerClient.java:98)
... 35 more
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException:
{"message":"driver failed programming external connectivity on endpoint
sharp_saha (10346b9df7546a9af1de07a0b26c269caa18781c455fe53db9b11ad6676ff6ee):
Bind for 0.0.0.0:8200 failed: port is already allocated"}
at
org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:276)
at
org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:254)
at
org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.post(OkHttpInvocationBuilder.java:115)
at
com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:28)
at
com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:11)
at
com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
at
com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
at
com.github.dockerjava.core.command.StartContainerCmdImpl.exec(StartContainerCmdImpl.java:46)
... 40 more
2019-09-04 16:07:12 ERROR 3]:287 - There are no stdout/stderr logs available
for the failed container
{noformat}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)