测试容器无法在 docker 中的 Jenkins kubernates docker 上获取映射端口

问题描述

我正在尝试在 Docker 容器中的 Jenkins Kubernetes Docker 上使用 Testcontainers 运行我的集成测试。

测试容器版本:1.15.3

但是,它总是无法在 dind 容器中获取 Container.getMappedPort(X)。

它在我的本地设置上运行良好,并设法获取映射端口。

有没有人遇到过这个问题或者有解决方案?

我的詹金斯文件

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "classpath:features")
public final class runcucumberIT {


    @BeforeClass
    public static void init(){
        Containers.POSTGRES.start();
        System.out.println("Exposed port of db is"+Containers.POSTGRES.getExposedPorts());
        System.out.println("Assigned port of db is"+Containers.POSTGRES.getFirstMappedPort());
        Containers.wiremock.start();
        Containers.S3.start();
    }

    private runcucumberIT() {

    }

}

测试运行器:

Requested port (X) is not mapped

Containers.POSTGRES.getFirstMappedPort() 失败

$redact

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)