arquillian / arquillian-cube

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

Flaky arquillian test with the log await strategy #1015

Open rpau opened 6 years ago

rpau commented 6 years ago
Issue Overview

Flaky arquillian test with the log await strategy

Expected Behaviour

No failures. The test succeeds

Current Behaviour
Caused by: javax.ws.rs.ProcessingException: Error closing message content input stream.
    at org.glassfish.jersey.message.internal.EntityInputStream.close(EntityInputStream.java:161)
    at com.github.dockerjava.jaxrs.util.WrappedResponseInputStream.close(WrappedResponseInputStream.java:60)
    at com.github.dockerjava.core.async.ResultCallbackTemplate.close(ResultCallbackTemplate.java:81)
    at org.arquillian.cube.docker.impl.await.LogScanningAwaitStrategy.await(LogScanningAwaitStrategy.java:82)
    at org.arquillian.cube.docker.impl.model.DockerCube.start(DockerCube.java:136)
    ... 18 more
Steps To Reproduce

It is a flaky test, so it is underterministic.

  1. We are using this arquillian.xml file: https://gist.github.com/rpau/501cf66020a5738e66f1775782424a8a
  2. The test class looks like this:
@RunWith(classOf[Arquillian])
class EventsStorageTest extends Matchers {

  @HostPort(containerName = "postgres*", value = 5432)
  val POSTGRES_PORT = 0

  @HostIp
  val POSTGRES_HOST = "localhost"

  var dataSource: DataSource = _

  @Before
  def createTables(): Unit = {
    dataSource = SkynetBuilders.postgres(username = "postgres", password = "123",
      url = "jdbc:postgresql://"+POSTGRES_HOST + ":" + POSTGRES_PORT+"/root")
     initDatabase()
  }

  def initDatabase(): Unit = {
    val flyway = new Flyway
    flyway.setDataSource(dataSource)
    flyway.migrate()
  }
Additional Information

Our build.gradle file has these dependencies

integrationCompile "org.arquillian.cube:arquillian-cube-docker:1.9.1",
                "org.jboss.arquillian.junit:arquillian-junit-standalone:1.1.13.Final",
dipak-pawar commented 6 years ago

@rpau Can you provide little reproducer for your flaky test with log await strategy? So we can dig deeper into this.

foogaro commented 6 years ago

@rpau I had similar problem, and I solved by increasing the timeout as follows:

<property name="dockerContainers">
  wildfly:
    buildImage:
      dockerfileLocation: src/test/resources
      dockerfileName: Dockerfile
      noCache: true
      remove: false
    exposedPorts: [8080/tcp, 9990/tcp]
    killContainer: true
    await:
      strategy: log
      match: WFLYSRV0051
      stdOut: true
      stdErr: true
      iterations: 100
      sleepPollingTime: 1 s
      timeout: 30
    portBindings: [8080->8080/tcp, 9990->9990/tcp]
</property>

Ciao, Luigi