为什么我的 Arquillian Drone 功能测试不能在 GitLab CI 上运行?
Why does my Arquillian Drone functional test not work on GitLab CI?
在 gitlab.com 的 GitLab CI 共享运行器(MCVE 位于 https://gitlab.com/krichter/gitlab-ci-file-creation, the log at https://gitlab.com/krichter/gitlab-ci-file-creation/-/jobs/40064276)上本地运行良好的测试失败,因为在提取 Arquillian webdriver 期间,目录无法被 Java 创建或认为不存在(详见下文):
Nov 13, 2017 7:31:32 AM org.glassfish.deployment.admin.DeployCommand execute
INFO: 664320b4-384a-414a-b0b4-546937428842 was successfully deployed in 7,496 milliseconds.
Nov 13, 2017 7:31:33 AM org.arquillian.spacelift.Spacelift$SpaceliftInstance <init>
INFO: Initialized Spacelift from defaults, workspace: /builds/krichter/gitlab-ci-file-creation, cache: /root/.spacelift/cache
Drone: downloading phantomjs-2.1.1-linux-x86_64.tar.bz2 from https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 to /root/.arquillian/drone/phantomjs/2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
................
Nov 13, 2017 7:31:34 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for UpdateTestResultBeforeAfter.update is null. It won't be invoked.
Nov 13, 2017 7:31:34 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for UpdateTestResultBeforeAfter.update is null. It won't be invoked.
Nov 13, 2017 7:31:34 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for ReusableRemoteWebDriverExtension.destroyLastRemoteWebDriver is null. It won't be invoked.
Nov 13, 2017 7:31:35 AM com.sun.enterprise.admin.cli.embeddable.DeployerImpl undeploy
INFO: 664320b4-384a-414a-b0b4-546937428842 was successfully undeployed
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 19.022 sec <<< FAILURE! - in richtercloud.gitlab.ci.file.creation.GitLabCIIT
testSomething(richtercloud.gitlab.ci.file.creation.GitLabCIIT) Time elapsed: 2.195 sec <<< ERROR!
java.lang.IllegalStateException: Something bad happened when Drone was trying to download and prepare a binary. For more information see the cause.
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.checkAndSetBinary(AbstractBinaryHandler.java:62)
at org.jboss.arquillian.drone.webdriver.factory.PhantomJSDriverFactory.getCapabilities(PhantomJSDriverFactory.java:99)
at org.jboss.arquillian.drone.webdriver.factory.PhantomJSDriverFactory.createInstance(PhantomJSDriverFactory.java:72)
at org.jboss.arquillian.drone.webdriver.factory.PhantomJSDriverFactory.createInstance(PhantomJSDriverFactory.java:37)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:127)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:38)
at org.jboss.arquillian.drone.impl.DroneConfigurator.createInstance(DroneConfigurator.java:112)
at org.jboss.arquillian.drone.impl.CachingCallableImpl.call(CachingCallableImpl.java:44)
at org.jboss.arquillian.core.impl.threading.ThreadedExecutorService$ContextualCallable.call(ThreadedExecutorService.java:89)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: The phantomJS binary is not present on the expected path target/drone/1c947d57fce2f21ce0b43fe2ed7cd361/phantomjs-2.1.1-linux-x86_64/bin/phantomjs
at org.jboss.arquillian.drone.webdriver.binary.handler.PhantomJSDriverBinaryHandler.prepare(PhantomJSDriverBinaryHandler.java:56)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.downloadAndPrepare(AbstractBinaryHandler.java:226)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.downloadAndPrepare(AbstractBinaryHandler.java:208)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.downloadAndPrepare(AbstractBinaryHandler.java:175)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.checkAndSetBinary(AbstractBinaryHandler.java:60)
... 12 more
Nov 13, 2017 7:31:36 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for SeleniumServerExecutor.stopSeleniumServer is null. It won't be invoked.
Nov 13, 2017 7:31:36 AM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
JdbcRuntimeExtension, getAllSystemRAResourcesAndPools = [GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource]
Nov 13, 2017 7:31:36 AM com.sun.enterprise.v3.server.AppServerStartup stop
INFO: Shutdown procedure finished
我正在使用
<dependencies>
[...]
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api-javaee</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>graphene-webdriver</artifactId>
<version>2.2.0</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.24</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
</dependency>
<!-- <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>-->
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.13.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.selenium</groupId>
<artifactId>selenium-bom</artifactId>
<version>3.7.0</version>
<!-- - 3.3.1, 3.2.0 and 3.1.0 cause required: java.util.function.Function<? super org.openqa.selenium.WebDriver,V>
found: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>
reason: cannot infer type-variable(s) V
(argument mismatch; org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebDriver,V>)
- 3.0.1 causes java.lang.IllegalAccessError: tried to access class org.openqa.selenium.os.ExecutableFinder from class org.openqa.selenium.phantomjs.PhantomJSDriverService when using phantomjs driver
- 3.6.0 causes `Unrecognized platform: linux-unknown-64bit`
which one is supposed to work around using 3.5.3
<ref>https://github.com/SeleniumHQ/selenium/issues/4781</ref>-->
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<version>2.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>arquillian-glassfish-embedded</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-all</artifactId>
<version>4.1.2.174-SNAPSHOT</version>
<!-- - 4.1.2.173 causes `java.lang.NoClassDefFoundError: fish/payara/nucleus/healthcheck/stuck/StuckThreadsStore`
- 4.1.2.172 causes `Caused by: java.lang.ClassNotFoundException: fish.payara.notification.eventbus.EventbusMessage` -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>src/test/resources-glassfish-embedded</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
并激活配置文件。
我从 http://phantomjs.org/download.html 下载、提取并调查了 phantomjs-2.1.1-linux-x86_64.tar.bz2
,并验证了其中存在 phantomjs-2.1.1-linux-x86_64/examples/colorwheel.js
。 Arquillian Drone Webdriver 使用 MD5 和 1c947d57fce2f21ce0b43fe2ed7cd361
作为目标目录,与下载的 .tar.bz2
.
相匹配
错误位于 Arquillian Spacelift 中,Arquillian Drone 使用它来提取 phantomjs 驱动程序,但您无法从堆栈跟踪中看到它,因为 Spacelift 会忽略目录创建失败(有关详细信息和信息,请参阅 https://github.com/arquillian/arquillian-spacelift/pull/34一个建议的修复程序,您可以通过指定
使用它
- git clone --branch file_utils_mkdir https://github.com/krichter722/arquillian-spacelift.git && cd arquillian-spacelift && mvn --batch-mode install && cd ..
在 .gitlab-ci.yml
的 main
作业中,并在 POM 中将 Spacelift 依赖项从 1.0.2 更改为 1.0.3-SNAPSHOT。
以与上述相同的方式更改 Spacelift 源并添加显式目录创建和 touch 语句,甚至在 Java 中使用 Python 以确保目录是使用 [=32 创建的=]
int pythonDebugReturncode = Runtime.getRuntime().exec(new String[] {"python3",
"-c",
String.format("'import os;os.makedirs(\"%s\");'",
file.getParentFile().getAbsoluteFile().getAbsolutePath())}).waitFor();
System.out.println("pythonDebugReturncode: "+pythonDebugReturncode);
pythonDebugReturncode = Runtime.getRuntime().exec(new String[] {"python3",
"-c",
String.format("'from pathlib import Path;Path(\"%s\").touch();'",
file.getAbsoluteFile().getAbsolutePath())}).waitFor();
System.out.println("pythonDebugReturncode: "+pythonDebugReturncode);
导致 0
s 被打印为返回代码,但目录使用相对路径在 Java 代码中失败。
我尝试了 docker 个图像 ubuntu:xenial
、ubuntu:trusty
、ubuntu:artful
、debian:sid
和 debian:buster
。只有基于 Afaik 的 Linux 系统才能用作 docker 图像。我不希望通过测试更多图像来获得更多见解。
我体验
java.net.UnknownHostException: runner-3bd5f424-project-4630314-concurrent-0: runner-3bd5f424-project-4630314-concurrent-0: Temporary failure in name resolution
at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
但我认为这与问题无关,因为不涉及网络文件系统,并且由于构建以 root
用户身份运行,因此不使用在获取权限期间的名称解析。
Arquillian Spacelift 或 Arquillian Drone Webdriver 无法解析工作目录,如果 Maven 在聚合器项目根目录和 Maven basedir 中启动,则工作目录不会更改。我在 https://issues.jboss.org/browse/ARQ-2154.
报告了此事
这意味着必须将mvn install
的正常运行拆分为运行,用-DskipTests=true -DskipITs=true
进行编译,然后将目录更改为子模块目录和 运行 mvn verify
.
在 gitlab.com 的 GitLab CI 共享运行器(MCVE 位于 https://gitlab.com/krichter/gitlab-ci-file-creation, the log at https://gitlab.com/krichter/gitlab-ci-file-creation/-/jobs/40064276)上本地运行良好的测试失败,因为在提取 Arquillian webdriver 期间,目录无法被 Java 创建或认为不存在(详见下文):
Nov 13, 2017 7:31:32 AM org.glassfish.deployment.admin.DeployCommand execute
INFO: 664320b4-384a-414a-b0b4-546937428842 was successfully deployed in 7,496 milliseconds.
Nov 13, 2017 7:31:33 AM org.arquillian.spacelift.Spacelift$SpaceliftInstance <init>
INFO: Initialized Spacelift from defaults, workspace: /builds/krichter/gitlab-ci-file-creation, cache: /root/.spacelift/cache
Drone: downloading phantomjs-2.1.1-linux-x86_64.tar.bz2 from https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 to /root/.arquillian/drone/phantomjs/2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
................
Nov 13, 2017 7:31:34 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for UpdateTestResultBeforeAfter.update is null. It won't be invoked.
Nov 13, 2017 7:31:34 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for UpdateTestResultBeforeAfter.update is null. It won't be invoked.
Nov 13, 2017 7:31:34 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for ReusableRemoteWebDriverExtension.destroyLastRemoteWebDriver is null. It won't be invoked.
Nov 13, 2017 7:31:35 AM com.sun.enterprise.admin.cli.embeddable.DeployerImpl undeploy
INFO: 664320b4-384a-414a-b0b4-546937428842 was successfully undeployed
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 19.022 sec <<< FAILURE! - in richtercloud.gitlab.ci.file.creation.GitLabCIIT
testSomething(richtercloud.gitlab.ci.file.creation.GitLabCIIT) Time elapsed: 2.195 sec <<< ERROR!
java.lang.IllegalStateException: Something bad happened when Drone was trying to download and prepare a binary. For more information see the cause.
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.checkAndSetBinary(AbstractBinaryHandler.java:62)
at org.jboss.arquillian.drone.webdriver.factory.PhantomJSDriverFactory.getCapabilities(PhantomJSDriverFactory.java:99)
at org.jboss.arquillian.drone.webdriver.factory.PhantomJSDriverFactory.createInstance(PhantomJSDriverFactory.java:72)
at org.jboss.arquillian.drone.webdriver.factory.PhantomJSDriverFactory.createInstance(PhantomJSDriverFactory.java:37)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:127)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:38)
at org.jboss.arquillian.drone.impl.DroneConfigurator.createInstance(DroneConfigurator.java:112)
at org.jboss.arquillian.drone.impl.CachingCallableImpl.call(CachingCallableImpl.java:44)
at org.jboss.arquillian.core.impl.threading.ThreadedExecutorService$ContextualCallable.call(ThreadedExecutorService.java:89)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: The phantomJS binary is not present on the expected path target/drone/1c947d57fce2f21ce0b43fe2ed7cd361/phantomjs-2.1.1-linux-x86_64/bin/phantomjs
at org.jboss.arquillian.drone.webdriver.binary.handler.PhantomJSDriverBinaryHandler.prepare(PhantomJSDriverBinaryHandler.java:56)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.downloadAndPrepare(AbstractBinaryHandler.java:226)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.downloadAndPrepare(AbstractBinaryHandler.java:208)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.downloadAndPrepare(AbstractBinaryHandler.java:175)
at org.jboss.arquillian.drone.webdriver.binary.handler.AbstractBinaryHandler.checkAndSetBinary(AbstractBinaryHandler.java:60)
... 12 more
Nov 13, 2017 7:31:36 AM org.jboss.arquillian.core.impl.ObserverImpl resolveArguments
WARNING: Argument 1 for SeleniumServerExecutor.stopSeleniumServer is null. It won't be invoked.
Nov 13, 2017 7:31:36 AM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
INFO: JMXStartupService and JMXConnectors have been shut down.
JdbcRuntimeExtension, getAllSystemRAResourcesAndPools = [GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcConnectionPool, GlassFishConfigBean.org.glassfish.jdbc.config.JdbcResource]
Nov 13, 2017 7:31:36 AM com.sun.enterprise.v3.server.AppServerStartup stop
INFO: Shutdown procedure finished
我正在使用
<dependencies>
[...]
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api-javaee</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>graphene-webdriver</artifactId>
<version>2.2.0</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.24</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
</dependency>
<!-- <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>-->
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.13.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.selenium</groupId>
<artifactId>selenium-bom</artifactId>
<version>3.7.0</version>
<!-- - 3.3.1, 3.2.0 and 3.1.0 cause required: java.util.function.Function<? super org.openqa.selenium.WebDriver,V>
found: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>
reason: cannot infer type-variable(s) V
(argument mismatch; org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebDriver,V>)
- 3.0.1 causes java.lang.IllegalAccessError: tried to access class org.openqa.selenium.os.ExecutableFinder from class org.openqa.selenium.phantomjs.PhantomJSDriverService when using phantomjs driver
- 3.6.0 causes `Unrecognized platform: linux-unknown-64bit`
which one is supposed to work around using 3.5.3
<ref>https://github.com/SeleniumHQ/selenium/issues/4781</ref>-->
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<version>2.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>arquillian-glassfish-embedded</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-all</artifactId>
<version>4.1.2.174-SNAPSHOT</version>
<!-- - 4.1.2.173 causes `java.lang.NoClassDefFoundError: fish/payara/nucleus/healthcheck/stuck/StuckThreadsStore`
- 4.1.2.172 causes `Caused by: java.lang.ClassNotFoundException: fish.payara.notification.eventbus.EventbusMessage` -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>src/test/resources-glassfish-embedded</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
并激活配置文件。
我从 http://phantomjs.org/download.html 下载、提取并调查了 phantomjs-2.1.1-linux-x86_64.tar.bz2
,并验证了其中存在 phantomjs-2.1.1-linux-x86_64/examples/colorwheel.js
。 Arquillian Drone Webdriver 使用 MD5 和 1c947d57fce2f21ce0b43fe2ed7cd361
作为目标目录,与下载的 .tar.bz2
.
错误位于 Arquillian Spacelift 中,Arquillian Drone 使用它来提取 phantomjs 驱动程序,但您无法从堆栈跟踪中看到它,因为 Spacelift 会忽略目录创建失败(有关详细信息和信息,请参阅 https://github.com/arquillian/arquillian-spacelift/pull/34一个建议的修复程序,您可以通过指定
使用它- git clone --branch file_utils_mkdir https://github.com/krichter722/arquillian-spacelift.git && cd arquillian-spacelift && mvn --batch-mode install && cd ..
在 .gitlab-ci.yml
的 main
作业中,并在 POM 中将 Spacelift 依赖项从 1.0.2 更改为 1.0.3-SNAPSHOT。
以与上述相同的方式更改 Spacelift 源并添加显式目录创建和 touch 语句,甚至在 Java 中使用 Python 以确保目录是使用 [=32 创建的=]
int pythonDebugReturncode = Runtime.getRuntime().exec(new String[] {"python3",
"-c",
String.format("'import os;os.makedirs(\"%s\");'",
file.getParentFile().getAbsoluteFile().getAbsolutePath())}).waitFor();
System.out.println("pythonDebugReturncode: "+pythonDebugReturncode);
pythonDebugReturncode = Runtime.getRuntime().exec(new String[] {"python3",
"-c",
String.format("'from pathlib import Path;Path(\"%s\").touch();'",
file.getAbsoluteFile().getAbsolutePath())}).waitFor();
System.out.println("pythonDebugReturncode: "+pythonDebugReturncode);
导致 0
s 被打印为返回代码,但目录使用相对路径在 Java 代码中失败。
我尝试了 docker 个图像 ubuntu:xenial
、ubuntu:trusty
、ubuntu:artful
、debian:sid
和 debian:buster
。只有基于 Afaik 的 Linux 系统才能用作 docker 图像。我不希望通过测试更多图像来获得更多见解。
我体验
java.net.UnknownHostException: runner-3bd5f424-project-4630314-concurrent-0: runner-3bd5f424-project-4630314-concurrent-0: Temporary failure in name resolution
at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
但我认为这与问题无关,因为不涉及网络文件系统,并且由于构建以 root
用户身份运行,因此不使用在获取权限期间的名称解析。
Arquillian Spacelift 或 Arquillian Drone Webdriver 无法解析工作目录,如果 Maven 在聚合器项目根目录和 Maven basedir 中启动,则工作目录不会更改。我在 https://issues.jboss.org/browse/ARQ-2154.
报告了此事这意味着必须将mvn install
的正常运行拆分为运行,用-DskipTests=true -DskipITs=true
进行编译,然后将目录更改为子模块目录和 运行 mvn verify
.