Skip to content
Snippets Groups Projects
Commit 154ca702 authored by Vincent Massol's avatar Vincent Massol
Browse files

[Misc] Try to make it work when we're in the DOOD use case (Docker outside of...

[Misc] Try to make it work when we're in the DOOD use case (Docker outside of Docker) by not mounting any directory and instead by copying the data inside the target container
parent dea0f024
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@
*/
package org.xwiki.test.docker.junit5;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
......@@ -38,6 +39,8 @@
*/
public abstract class AbstractContainerExecutor
{
private static final boolean IN_A_CONTAINER = new File("/.dockerenv").exists();
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractContainerExecutor.class);
protected void start(GenericContainer container, TestConfiguration testConfiguration)
......@@ -72,7 +75,7 @@ protected void mountFromHostToContainer(GenericContainer container, String sourc
// File mounting is awfully slow on Mac OSX. For example starting Tomcat with XWiki mounted takes
// 45s+, while doing a COPY first and then starting Tomcat takes 8s (+5s for the copy).
String osName = System.getProperty("os.name").toLowerCase();
if (osName.startsWith("mac os x")) {
if (IN_A_CONTAINER || osName.startsWith("mac os x")) {
MountableFile mountableDirectory = MountableFile.forHostPath(sourceDirectory);
container.withCopyFileToContainer(mountableDirectory, targetDirectory);
} else {
......
......@@ -64,11 +64,11 @@ public BrowserWebDriverContainer start()
.withCapabilities(browser.getCapabilities())
.withNetwork(Network.SHARED)
.withNetworkAliases("vnchost")
.withRecordingMode(BrowserWebDriverContainer.VncRecordingMode.SKIP, null)
.withRecordingMode(BrowserWebDriverContainer.VncRecordingMode.SKIP, null);
// In case some test-resources are provided, they need to be available from the browser
// for example in order to upload some files on the wiki.
.withFileSystemBind(getTestResourcePathOnHost(), browser.getTestResourcesPath());
// In case some test-resources are provided, they need to be available from the browser
// for example in order to upload some files on the wiki.
mountFromHostToContainer(webDriverContainer, getTestResourcePathOnHost(), browser.getTestResourcesPath());
if (this.testConfiguration.isVerbose()) {
LOGGER.info(String.format("Test resource path mapped: On Host [%s], in Docker: [%s]",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment