测试容器与Bitbucket流水线的问题。

huangapple go评论65阅读模式
英文:

Testcontainer issue with Bitbucket pipelines

问题

我配置了 bitbucket-pipelines.yml,并且使用了 image: gradle:6.3.0-jdk11。我的项目基于 Java11 和 Gradle 6.3 进行构建。一切都正常,直到开始运行测试用例。因为我使用了 Testcontainers 来测试应用程序。然而 Bitbucket 无法启动 Testcontainer。
错误信息如下:
org.testcontainers.containers.ContainerLaunchException: 容器启动失败

如何解决这个问题呢?

英文:

I configured bitbucket-pipelines.yml and used image: gradle:6.3.0-jdk11. My project built on Java11 and Gradle 6.3. Everything was Ok till starting test cases. Because I used Testontainers to test the application. Bitbucket could not start up the Testcontainer.
The error is:
org.testcontainers.containers.ContainerLaunchException: Container startup failed

How can be fixed the issue?

答案1

得分: 6

如果在 Bitbucket pipelines 中使用 Testcontainers,可能会出现一些问题。例如,像上面提到的问题。可以通过将以下命令放入 bitbucket-pipelines.yml 中来解决此问题。这里的基本命令是一个环境变量。

TESTCONTAINERS_RYUK_DISABLED=true

完整的流水线可能如下所示:

image: maven:3.6.1

pipelines:
  default:
    - step:
        script:
          - export TESTCONTAINERS_RYUK_DISABLED=true
          - mvn clean install
        services:
          - docker
definitions:
  services:
    docker:
      memory: 2048
英文:

If used Testcontainers inside the Bitbucket pipelines, There might be some issues. For instance, some issues like mentioned above. This issue can be fixed putting by following commands into bitbucket-pipelines.yml
Here the basic command is an environment variable.

TESTCONTAINERS_RYUK_DISABLED=true.
The full pipeline might be like this:


pipelines:
  default:
    - step:
        script:
          - export TESTCONTAINERS_RYUK_DISABLED=true
          - mvn clean install
        services:
          - docker
definitions:
  services:
    docker:
      memory: 2048

</details>



huangapple
  • 本文由 发表于 2020年4月10日 18:59:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/61138898.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定