testcontainers / testcontainers/testcontainers-java
[Bug]: Error in running test on kube-jenkins
オープン
まだ誰も着手していません。
resolution/waiting-for-info
type/bug
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 9
説明
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_
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
EntityRepositoryTest と MyRepositoryPostgresqlContainer から始め、報告されている Docker および PostgreSQL のイメージ設定を使用して、kube-jenkins 環境で失敗を再現します。単一の InternalServerErrorException 行だけでなく、Docker と Jenkins の完全なログを収集し、ローカルで成功した実行と比較します。環境固有の原因を特定し、検証済みの解決策を文書化または実装できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, java, postgresql
- 領域
- ci-cd, databases, testing
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100