我尝试使用 testcontainers 的docker -compose 模块编写 spring-boot 集成测试。我在启动时收到以下异常:
java.lang.ExceptionInInitializerError
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException:
{"message":"Get https://quay.io/v2/: dial tcp: lookup quay.io on 192.168.65.1:53: no such host"}
我已经尝试使用 Env 添加我们公司的 http 代理,但它不起作用。
@RunWith(SpringRunner.class)
@SpringBootTest
public class FtpExportIntegrationTest {
@ClassRule
public static DockerComposeContainer environment =
new DockerComposeContainer(new File("src/test/resources/docker-compose.yml"))
.withExposedService("search-kafka", 9092)
.withEnv("HTTP_PROXY", "http://proxy.mycompany.com:8080")
.withEnv("HTTPS_PROXY", "http://proxy.mycompany.com:8080")
.withEnv("http_proxy", "http://proxy.mycompany.com:8080")
.withEnv("https_proxy", "http://proxy.mycompany.com:8080");