[Bug]: DockerDesktopClientProviderStrategy is always applicable
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- docker, java
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Kiểm tra DockerDesktopClientProviderStrategy, tập trung vào socketPath, isApplicable() và getTransportConfig(). Trước tiên, hãy tái hiện việc lựa chọn strategy trên macOS không có Docker Desktop, sau đó xem lại các test lân cận hoặc test suite của strategy. Hoàn tất khi strategy không được chọn nếu socket của nó không khả dụng và không xảy ra NullPointerException trong khi thử các cấu hình.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Java
- Star
- 8.7k
- Fork
- 1.9k
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 9
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của testcontainers/testcontainers-java
-
type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
testcontainers/testcontainers-java#11997 · 1 bình luận ·
-
[Enhancement]: Document why singleton containers are required under Spring's test context caching Đang mởtype/enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
testcontainers/testcontainers-java#11967 ·
-
type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
testcontainers/testcontainers-java#11941 ·
-
type/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
testcontainers/testcontainers-java#11578 ·
-
help wanted type/feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
testcontainers/testcontainers-java#8657 · 4 bình luận ·
Tất cả issue của testcontainers/testcontainers-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
objectionary/hone-maven-plugin#1061 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
spring-projects/spring-modulith#1895 ·