[Bug]: Error in running test on kube-jenkins
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
调研方向
从 EntityRepositoryTest 和 MyRepositoryPostgresqlContainer 开始,然后使用报告中的 Docker 和 PostgreSQL 镜像配置在 kube-jenkins 环境中重现失败。收集完整的 Docker 和 Jenkins 日志,不要只收集单独的 InternalServerErrorException 行,并将其与一次成功的本地运行进行比较。完成的标准是确定特定于环境的原因,并记录或实现经过验证的解决方案。
由索引模型根据 Issue 内容生成。
描述
Module
PostgreSQL
Testcontainers version
1.16.3
Using the latest Testcontainers version?
Yes
Host OS
linux
Host Arch
x86
Docker version
Container Runtime Version: docker://20.10.7
What happened?
I am using testcontainers for my unit test for repository, it passes locally but failed in the jenkins, and it only have one line log trace:
EntityRepositoryTest > initializationError FAILED
com.github.dockerjava.api.exception.InternalServerErrorException at DefaultInvocationBuilder.java:247
Here are my code, I retaged and pushed postgres:13.2 to company's private jfrog
public class MyRepositoryPostgresqlContainer extends PostgreSQLContainer<MyRepositoryPostgresqlContainer> {
static private DockerImageName myImage = DockerImageName.parse("comany./postgres:13.2").asCompatibleSubstituteFor("postgres");
private static MyRepositoryPostgresqlContainer container;
private MyRepositoryPostgresqlContainer(DockerImageName myImage) {
super(myImage);
}
public static MyRepositoryPostgresqlContainer getInstance() {
if (container == null) {
container = new MyRepositoryPostgresqlContainer(myImage)
.withDatabaseName("XXX")
.withUsername("XXX")
.withPassword("XXX);
}
return container;
}
...
}
@ContextConfiguration(initializers = {MyTest.Initializer.class})
public class MyTest {
@ClassRule
public static PostgreSQLContainer postgreSQLContainer = MyRepositoryPostgresqlContainer.getInstance();
static class Initializer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
TestPropertyValues.of(
"spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(),
"spring.datasource.username=" + postgreSQLContainer.getUsername(),
"spring.datasource.password=" + postgreSQLContainer.getPassword()
).applyTo(configurableApplicationContext.getEnvironment());
}
}
}
@SpringBootTest
@RunWith(SpringRunner.class)
public class EntityRepositoryTest extends MyTest{
@Autowired
private MyRepository repo;
@Test
public void test() {
MyEntity myEntity = MyEntity.builder().
....
.build();
repo.saveAndFlush(myEntity);
assertEquals(1, repo.findAll().size());
}
}
Any suggestion helps, Thanks
Relevant log output
EntityRepositoryTest > initializationError FAILED
com.github.dockerjava.api.exception.InternalServerErrorException at DefaultInvocationBuilder.java:247
### Additional Information
_No response_
- 主要语言
- Java
- 星标
- 8.7k
- 派生
- 1.9k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testcontainers/testcontainers-java 的其他 Issue
-
type/bug
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-java#11997 · 1 条评论 ·
-
[Enhancement]: Document why singleton containers are required under Spring's test context caching 未关闭type/enhancement
难度 1/5 1 小时以内 新手友好度 85/100
testcontainers/testcontainers-java#11967 ·
-
type/bug
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-java#11941 ·
-
type/bug
难度 2/5 1-3 小时 新手友好度 74/100
testcontainers/testcontainers-java#11829 · 1 条评论 ·
-
type/enhancement
难度 2/5 1-3 小时 新手友好度 65/100
testcontainers/testcontainers-java#11578 ·
查看 testcontainers/testcontainers-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
bug needs triage
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1 小时以内 新手友好度 94/100
objectionary/hone-maven-plugin#1061 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
spring-projects/spring-modulith#1895 ·