testcontainers / testcontainers/testcontainers-java
Testcontainer interacting with a java class that depeneds on the product
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 9
説明
Hi,
I am working on Call Home Client (SSH) for our product.
src/main/java
src/test/java
src/test/resources
/call-home-ssh-client/Dockerfile
/netopeer2/Dockerfile
I want to use the excellent testcontainer to test with a server (netopeer2). So I have created a test client ( src/test/java) that depends on our product ( src/main/java).
So I want to start call-home-ssh-client from docker image in a unit test. Then create the netopeer2 server from the other image and trigger call-home from it.
So for the call-home-ssh-client I need to build the src tree of my project and create a jar. Then I would run the specific test client inside the container.
Problem I am facing is that when I call the call-home-ssh-client from unit test with this part:
final ImageFromDockerfile callHomeSshImage = new ImageFromDockerfile(
"ssh-client", false)
.withFileFromClasspath(".", "call-home-ssh-client");
return new GenericContainer<>(callHomeSshImage)
.withExposedPorts(new Integer[] { 4334 })
.withLogConsumer(logConsumer)
.waitingFor(new LogMessageWaitStrategy().withRegEx(".*Call Home listening on port [4334]*"));
and using this part of my call-home-ssh-client Dockerfile
FROM maven:3.6.1-jdk-8-alpine AS MAVEN_BUILD
WORKDIR /app
# copy the pom and src code to the container
COPY ../src ./
RUN mvn clean package
Could not build image: COPY failed: Forbidden path outside the build context: ../src
Do I need to create my GenericContainer in another way to support this?
The other option I was thinking of would be to create the call-home-ssh-client as a java thread and have it running while
I start my server ( netopeer2 ) also as Docker container. Could they talk to eachother?
I would appreciate if you could tell me what is possible to do with testcontainers since I could not figure it out from documentation.
br,
//mike
Ps. Testcontainers is a really neat feature!
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、src/test/java のコンテナセットアップと call-home-ssh-client/Dockerfile を確認します。特に、ImageFromDockerfile と withFileFromClasspath のエントリーポイントを確認してください。Forbidden path outside the build context エラーを再現し、そのうえで、必要な source ファイルと JAR ファイルの提供方法をサポート対象の動作またはドキュメントで説明すべきかを判断します。integration-test のセットアップで両方のコンテナをビルドして実行する方法が文書化または検証されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- docker, java
- 領域
- devops, testing
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100