arquillian / arquillian-cube

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

Drone and Cube - not connecting to the browser container - java.lang.RuntimeException: Could not auto start container browser_ #1213

Open jagdeepjain opened 3 years ago

jagdeepjain commented 3 years ago
Issue Overview

I am using Drone, Cube together with JUnit for UI testing, I wan to run the test in parallel and trying to follow the cubedrone param containerNameStrategy but not able to utilize it and tests were failing

 java.lang.RuntimeException: Could not auto start container browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0
Caused by: org.arquillian.cube.spi.CubeControlException: Could not start browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0
Caused by: java.lang.IllegalArgumentException: Cannot connect to browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0 container

And sometimes running the same tests give different error:

[ERROR] org.jagdeep.example.arquillian.google.tests.Google1Test  Time elapsed: 2.969 s  <<< ERROR!
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
Caused by: java.lang.reflect.InvocationTargetException
Caused by: org.arquillian.spacelift.execution.ExecutionException: Execution of a task failed. Execution of a task failed. Unable to execute task SpawnProcessTask
Caused by: java.io.IOException: Cannot run program "boot2docker": error=2, No such file or directory
Caused by: java.io.IOException: error=2, No such file or directory

boot2docker is already fixed in different context here I am relying on drone created container browser instead of having my own container.

This is just a google search test and no fancy stuff.

Expected Behaviour

Test Should run in parallel connecting the drone browser container

Current Behaviour

Tests are failing...

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.211 s <<< FAILURE! - in org.jagdeep.example.arquillian.google.tests.Google1Test
[ERROR] org.jagdeep.example.arquillian.google.tests.Google1Test  Time elapsed: 7.209 s  <<< ERROR!
java.lang.RuntimeException: Could not auto start container browser_b123af86-cd3f-445d-a84f-4964c6aeacc4
Caused by: org.arquillian.cube.spi.CubeControlException: Could not start browser_b123af86-cd3f-445d-a84f-4964c6aeacc4
Caused by: java.lang.IllegalArgumentException: Cannot connect to browser_b123af86-cd3f-445d-a84f-4964c6aeacc4 container

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.251 s <<< FAILURE! - in org.jagdeep.example.arquillian.google.tests.Google2Test
[ERROR] org.jagdeep.example.arquillian.google.tests.Google2Test  Time elapsed: 7.25 s  <<< ERROR!
java.lang.RuntimeException: Could not auto start container browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0
Caused by: org.arquillian.cube.spi.CubeControlException: Could not start browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0
Caused by: java.lang.IllegalArgumentException: Cannot connect to browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0 container
Steps To Reproduce

https://github.com/jagdeepjain/webdriver-arquillian-test/blob/master/README.md

Additional Information

https://github.com/jagdeepjain/webdriver-arquillian-test/

arquillian.xml

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

    <!-- for properties refer https://docs.jboss.org/author/display/ARQ/Drone  -->

    <extension qualifier="webdriver">
        <property name="browser">chrome</property>
        <property name="chromeArguments">--disable-extensions --start-maximized --disable-infobars</property>
        <property name="remoteAddress">http://localhost:4444/wd/hub</property>
        <property name="remoteReusable">false</property>
        <property name="dimensions">1360x768</property>
    </extension>

    <extension qualifier="graphene">
        <property name="url">https://www.google.co.in/</property>
        <property name="waitGuiInterval">60</property>
        <property name="waitAjaxInterval">60</property>
        <property name="waitModelInterval">60</property>
    </extension>

    <extension qualifier="cubedrone">
        <property name="recordingMode">NONE</property>
        <property name="containerNameStrategy">RANDOM</property>
    </extension>

    <extension qualifier="drone">
        <property name="instantiationTimeoutInSeconds">120</property>
    </extension>

</arquillian>

pom.xml

 <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.7.0.Alpha7</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.extension</groupId>
            <artifactId>arquillian-drone-bom</artifactId>
            <version>2.5.2</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.arquillian.cube</groupId>
            <artifactId>arquillian-cube-bom</artifactId>
            <version>1.18.2</version>
            <type>pom</type>
        </dependency>

    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>2.3.2</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-standalone</artifactId>
        <version>1.7.0.Alpha7</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.github.stephenc.jcip</groupId>
        <artifactId>jcip-annotations</artifactId>
        <version>1.0-1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.arquillian.cube</groupId>
        <artifactId>arquillian-cube-docker</artifactId>
        <version>1.18.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.arquillian.cube</groupId>
        <artifactId>arquillian-cube-docker-drone</artifactId>
        <version>1.18.2</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-webdriver-depchain</artifactId>
        <version>2.5.2</version>
        <type>pom</type>
        <scope>test</scope>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.2</version>
            <configuration>
                <forkCount>2</forkCount>
                <reuseForks>true</reuseForks>
            </configuration>
        </plugin>
    </plugins>
</build>

Below is the test execute log.

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.jagdeep.example.arquillian.google.tests.Google1Test
[INFO] Running org.jagdeep.example.arquillian.google.tests.Google2Test
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Feb 15, 2021 12:16:26 AM org.arquillian.cube.docker.impl.client.CubeDockerConfigurationResolver resolveSystemDefaultSetup
INFO: Connected to docker (docker-desktop) using default settings version: 19.03.12 kernel: 4.19.76-linuxkit
Feb 15, 2021 12:16:26 AM org.arquillian.cube.docker.impl.client.CubeDockerConfigurationResolver resolveSystemDefaultSetup
INFO: Connected to docker (docker-desktop) using default settings version: 19.03.12 kernel: 4.19.76-linuxkit
Feb 15, 2021 12:16:26 AM org.arquillian.spacelift.Spacelift$SpaceliftInstance <init>
INFO: Initialized Spacelift from defaults, workspace: /Users/jagdeepjain/git/webdriver-arquillian-test, cache: 
/Users/jagdeepjain/.spacelift/cache
Feb 15, 2021 12:16:26 AM org.arquillian.spacelift.Spacelift$SpaceliftInstance <init>
INFO: Initialized Spacelift from defaults, workspace: /Users/jagdeepjain/git/webdriver-arquillian-test, cache: 
/Users/jagdeepjain/.spacelift/cache
CubeDockerConfiguration:
  serverUri = unix:///var/run/docker.sock
  tlsVerify = false
  dockerServerIp = localhost
  definitionFormat = COMPOSE
  clean = false
  removeVolumes = true
  dockerContainers = containers: {}
networks: {}

CubeDockerConfiguration:
  serverUri = unix:///var/run/docker.sock
  tlsVerify = false
  dockerServerIp = localhost
  definitionFormat = COMPOSE
  clean = false
  removeVolumes = true
  dockerContainers = containers: {}
networks: {}

SELENIUM INSTALLED
SELENIUM INSTALLED
containers:
  browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0:
    alwaysPull: false
    await: {occurrences: 1, responseCode: 200, stdErr: false, stdOut: true, strategy: http,
      timeout: 15, url: 'http://dockerHost:63604'}
    image: selenium/standalone-chrome-debug:3.11.0
    killContainer: true
    manual: false
    portBindings: [63604->4444/tcp]
    readonlyRootfs: false
    removeVolumes: true
networks: {}

containers:
  browser_b123af86-cd3f-445d-a84f-4964c6aeacc4:
    alwaysPull: false
    await: {occurrences: 1, responseCode: 200, stdErr: false, stdOut: true, strategy: http,
      timeout: 15, url: 'http://dockerHost:55484'}
    image: selenium/standalone-chrome-debug:3.11.0
    killContainer: true
    manual: false
    portBindings: [55484->4444/tcp]
    readonlyRootfs: false
    removeVolumes: true
networks: {}

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.211 s <<< FAILURE! - in org.jagdeep.example.arquillian.google.tests.Google1Test
[ERROR] org.jagdeep.example.arquillian.google.tests.Google1Test  Time elapsed: 7.209 s  <<< ERROR!
java.lang.RuntimeException: Could not auto start container browser_b123af86-cd3f-445d-a84f-4964c6aeacc4
Caused by: org.arquillian.cube.spi.CubeControlException: Could not start browser_b123af86-cd3f-445d-a84f-4964c6aeacc4
Caused by: java.lang.IllegalArgumentException: Cannot connect to browser_b123af86-cd3f-445d-a84f-4964c6aeacc4 container

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.251 s <<< FAILURE! - in org.jagdeep.example.arquillian.google.tests.Google2Test
[ERROR] org.jagdeep.example.arquillian.google.tests.Google2Test  Time elapsed: 7.25 s  <<< ERROR!
java.lang.RuntimeException: Could not auto start container browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0
Caused by: org.arquillian.cube.spi.CubeControlException: Could not start browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0
Caused by: java.lang.IllegalArgumentException: Cannot connect to browser_0febd7ee-323e-46cf-9f2a-e3a13e070af0 container

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   Google1Test.org.jagdeep.example.arquillian.google.tests.Google1Test » Runtime ...
[ERROR]   Google2Test.org.jagdeep.example.arquillian.google.tests.Google2Test » Runtime ...
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.210 s
[INFO] Finished at: 2021-02-15T00:16:31+05:30
[INFO] Final Memory: 36M/375M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project arquillian-ui-test: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/jagdeepjain/git/webdriver-arquillian-test/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Some times I get different error:

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.jagdeep.example.arquillian.google.tests.Google1Test
[INFO] Running org.jagdeep.example.arquillian.google.tests.Google2Test
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Feb 15, 2021 1:27:46 AM org.arquillian.cube.docker.impl.client.CubeDockerConfigurationResolver resolveSystemDefaultSetup
INFO: Could not connect to default socket unix:///var/run/docker.sock. Go on with
Feb 15, 2021 1:27:46 AM org.arquillian.spacelift.Spacelift$SpaceliftInstance <init>
INFO: Initialized Spacelift from defaults, workspace: /Users/jagdeepjain/git/webdriver-arquillian-test, cache: /Users/jagdeepjain/.spacelift/cache
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.971 s <<< FAILURE! - in org.jagdeep.example.arquillian.google.tests.Google1Test
[ERROR] org.jagdeep.example.arquillian.google.tests.Google1Test  Time elapsed: 2.969 s  <<< ERROR!
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
Caused by: java.lang.reflect.InvocationTargetException
Caused by: org.arquillian.spacelift.execution.ExecutionException: Execution of a task failed. Execution of a task failed. Unable to execute task SpawnProcessTask
Caused by: java.io.IOException: Cannot run program "boot2docker": error=2, No such file or directory
Caused by: java.io.IOException: error=2, No such file or directory
jagdeepjain commented 3 years ago

This works fine when I run individual test.