arquillian / arquillian-cube

Control (docker, kubernetes, openshift) containers in your tests with ease!
http://arquillian.org/arquillian-cube/
117 stars 98 forks source link

Not able to connect to payara without explicit portBindings #1206

Open sschober opened 3 years ago

sschober commented 3 years ago
Issue Overview

I am using arquillian cube 1.16.0 and I am trying to find a configuration that allows concurrent executions of tests on the same hosts.

Working Config (But not what I want)

So, the following config works, but binds two ports to the host (4848 and 8080) and thus will lead to collisions:

    <property name="dockerContainers">
          payara:
            image: payara/server-full:latest
            await:
              strategy: polling
            env: []
            portBindings: [4848,8080]
      </property>

docker ps shows me this:

0ec328f41601        payara/server-full:latest   "/tini -- /bin/sh -c??"   1 second ago        Up Less than a second   0.0.0.0:4848->4848/tcp, 8181/tcp, 0.0.0.0:8080->8080/tcp, 9009/tcp   payara

and ss -atn shows the ports are being used on the host:

LISTEN               0                 4096                                          *:4848                                             *:*                                  
LISTEN               0                 4096                                          *:8080                                             *:*                                  
Not working config (but what I want to do)

I've found the following issue: https://github.com/arquillian/arquillian-cube/issues/66 and that suggested using publishAllPorts: true, which I tried with the following config:

payara:
            image: payara/server-full:latest
            await:
              strategy: polling
            env: []
            publishAllPorts: true

But that brings the following error (I've shortened the stacktrace somewhat):

org.arquillian.cube.spi.CubeControlException: Could not start payara
    at org.arquillian.cube.spi.CubeControlException.failedStart(CubeControlException.java:19)
    at org.arquillian.cube.docker.impl.model.DockerCube.start(DockerCube.java:141)
    at org.arquillian.cube.impl.client.CubeLifecycleController.start(CubeLifecycleController.java:19)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
Caused by: java.lang.IllegalArgumentException: Cannot connect to payara container
    at org.arquillian.cube.docker.impl.model.DockerCube.start(DockerCube.java:136)
    ... 87 more

docker ps shows, that the publishing to random ports works as expected:

ce46daa0a09d        payara/server-full:latest   "/tini -- /bin/sh -c??"   6 seconds ago       Up 5 seconds        0.0.0.0:32775->4848/tcp, 0.0.0.0:32774->8080/tcp, 0.0.0.0:32773->8181/tcp, 0.0.0.0:32772->9009/tcp   payara

But somehow, arquillian-cube is not picking up these ports.

Am I missing something here?

Additional Info

My complete config:

<?xml version="1.0"?>
<arquillian
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://jboss.org/schema/arquillian"
  xsi:schemaLocation="http://jboss.org/schema/arquillian
  http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

  <engine>
    <property name="deploymentExportPath">target/arquillian</property>
  </engine>

  <extension qualifier="docker">
    <property name="serverVersion">1.12</property>
    <property name="serverUri">http://localhost:2375</property>
    <property name="definitionFormat">CUBE</property>
    <property name="dockerContainers">
          payara:
            image: payara/server-full:latest
            await:
              strategy: polling
            env: []
            publishAllPorts: true
      </property>
  </extension>

  <container qualifier="payara" default="true">
    <configuration>
      <property name="adminUser">admin</property>
      <property name="adminPassword">admin</property>
      <property name="adminHttps">true</property>
      <property name="authorisation">true</property>
    </configuration>
  </container>

</arquillian>