Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XWiki
xwiki-platform
Commits
29b5a89d
Commit
29b5a89d
authored
6 years ago
by
Vincent Massol
Browse files
Options
Downloads
Patches
Plain Diff
[Misc] Revert the try to make it work when inside a docker container since it cannot work this way
parent
28f0a437
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-docker/src/main/java/org/xwiki/test/docker/junit5/AbstractContainerExecutor.java
+8
-29
8 additions, 29 deletions
...g/xwiki/test/docker/junit5/AbstractContainerExecutor.java
with
8 additions
and
29 deletions
xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-docker/src/main/java/org/xwiki/test/docker/junit5/AbstractContainerExecutor.java
+
8
−
29
View file @
29b5a89d
...
...
@@ -19,11 +19,6 @@
*/
package
org.xwiki.test.docker.junit5
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
...
...
@@ -45,8 +40,6 @@ public abstract class AbstractContainerExecutor
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AbstractContainerExecutor
.
class
);
private
static
final
boolean
IN_A_CONTAINER
=
new
File
(
"/.dockerenv"
).
exists
();
protected
void
start
(
GenericContainer
container
,
TestConfiguration
testConfiguration
)
{
if
(
testConfiguration
.
isVerbose
())
{
...
...
@@ -71,33 +64,19 @@ protected void start(GenericContainer container, TestConfiguration testConfigura
* @param container the container on which to mount the directory.
* @param sourceDirectory the path of the directory on the host to mount in the container.
* @param targetDirectory the target where to mount the directory in the container.
* @throws IOException if the symlink creation fails
* @since 10.11RC1
*/
protected
void
mountFromHostToContainer
(
GenericContainer
container
,
String
sourceDirectory
,
String
targetDirectory
)
throws
IOException
String
targetDirectory
)
{
// If we're inside a docker container already (docker on docker pattern), then the Docker daemon will be the
// one from the HOST and hence, any volumes that are mounted is still referenced from the HOST, and not from
// the Container.
// Thus we need to map the source and target to the same path and we simulate this by creating a symlink
// on the HOST to the target location.
if
(
IN_A_CONTAINER
)
{
Path
existing
=
Paths
.
get
(
sourceDirectory
);
Path
link
=
Paths
.
get
(
targetDirectory
);
Files
.
createDirectories
(
link
.
getParent
());
Files
.
createSymbolicLink
(
link
,
existing
);
container
.
withFileSystemBind
(
targetDirectory
,
targetDirectory
);
// 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"
))
{
MountableFile
mountableDirectory
=
MountableFile
.
forHostPath
(
sourceDirectory
);
container
.
withCopyFileToContainer
(
mountableDirectory
,
targetDirectory
);
}
else
{
// 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"
))
{
MountableFile
mountableDirectory
=
MountableFile
.
forHostPath
(
sourceDirectory
);
container
.
withCopyFileToContainer
(
mountableDirectory
,
targetDirectory
);
}
else
{
container
.
withFileSystemBind
(
sourceDirectory
,
targetDirectory
);
}
container
.
withFileSystemBind
(
sourceDirectory
,
targetDirectory
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment