[Bug]: DockerDesktopClientProviderStrategy is always applicable
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- docker, java
- 領域
- testing-qa
調査の方向性
DockerDesktopClientProviderStrategy を調査し、socketPath、isApplicable()、getTransportConfig() に注目してください。まず Docker Desktop がない macOS で戦略の選択を再現し、その後、近くにあるテストまたは戦略のテストスイートを確認してください。ソケットが利用できない場合にその戦略が選択されず、設定が試行されている間に NullPointerException が発生しなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Module
Core
Testcontainers version
2.0.5
Using the latest Testcontainers version?
Yes
Host OS
macOS
Host Arch
ARM
Docker version
29.5.3
What happened?
DockerDesktopClientProviderStrategy is always applicable even when Docker Desktop is not installed at all. It happens because the socketPath field is annotated with @Getter(lazy = true) and so its actual type is AtomicReference, but the isApplicable() method checks nullability as this.socketPath != null.
@Getter(lazy = true)
@Nullable
private final Path socketPath = resolveSocketPath();
@Override
protected boolean isApplicable() {
return (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC) && this.socketPath != null;
}
Finally, the getTransportConfig() method fails with NPE as getSocketPath() returns null.
@Override
public TransportConfig getTransportConfig() throws InvalidConfigurationException {
return TransportConfig.builder().dockerHost(URI.create("unix://" + getSocketPath().toString())).build();
}
Relevant log output
[Test worker] ERROR o.t.d.DockerClientProviderStrategy - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
DockerDesktopClientProviderStrategy: failed with exception NullPointerException (Cannot invoke "java.nio.file.Path.toString()" because the return value of "org.testcontainers.dockerclient.DockerDesktopClientProviderStrategy.getSocketPath()" is null)
Additional Information
No response
- 主要言語
- Java
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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/enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
testcontainers/testcontainers-java#11578 ·
-
help wanted type/feature
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
testcontainers/testcontainers-java#8657 · コメント 4 件 ·
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 ·