【发布时间】:2022-04-13 00:24:26
【问题描述】:
美好的一天! 可以在没有互联网访问的情况下使用测试容器吗?我下载了所需的容器。他们启动并运行。在这种情况下,运行测试时会发生错误。我无法上网
代码
container = new BrowserWebDriverContainer<>().withCapabilities(Capabilities.getFirefoxOptions()).withRecordingMode(
webDriverForm.get().isVideoError() ? VncRecordingMode.RECORD_FAILING : VncRecordingMode.RECORD_ALL,
new File(webDriverForm.get().getVideoPath()), VncRecordingFormat.MP4);
ontainer.start();
WebDriver driver = container.getWebDriver();
错误
2021-09-27 17:54:47 INFO Connected to docker:
Server Version: 20.10.8
API Version: 1.41
Operating System: Docker Desktop
Total Memory: 12700 MB
2021-09-27 17:54:47 INFO Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2021-09-27 17:54:48 INFO Credential helper/store (docker-credential-desktop) does not have credentials for index.docker.io
2021-09-27 17:54:49 ERROR Error during callback
com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on 192.168.65.5:53: no such host"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
at java.lang.Thread.run(Thread.java:748)
Когда пользователь открывает страницу по параметру "https://confluence.ca.sbrf.ru/pages/viewpage.action?pageId=240980441" # CommonStepDefinitionsGUI.loginInFs(String)
com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"Get \"https://registry-1.docker.io/v2/\": dial tcp: lookup registry-1.docker.io on 192.168.65.5:53: no such host"}
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
at java.lang.Thread.run(Thread.java:748)
at ✽.пользователь открывает страницу по параметру "https://confluence.ca.sbrf.ru/pages/viewpage.action?pageId=240980441"(file:src/test/resources/features/CSA-T1405_Проверка_отображения_Соответствует.feature:6)
只有保存的容器才能在 docker 中运行。
Docker 中的容器
alpine 3.14 14119a10abf4 about 1 month ago 5.6 MB
docker/getting-started latest 083d7564d904 4 months ago 27.99 MB
hello-world latest feb5d9fea6a5 4 days ago 13.26 KB
hello-world <none> d1165f221234 7 months ago 13.34 KB
redis 5.0.3-alpine 3d2a373f46ae over 2 years ago 50.83 MB
selenium/standalone-chrome-debug 2.45.0 d7852787b42a over 6 years ago 750.74 MB
selenium/standalone-firefox-debug 2.45.0 a86fa79ad0c8 over 6 years ago 594.67 MB
testcontainers/ryuk 0.3.2 b24c56207c68 about 2 months ago 11.95 MB
testcontainers/vnc-recorder 1.1.0 e51c318c86f4 over 1 year ago 306.86 MB
【问题讨论】:
标签: testcontainers