-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable copyFileToContainer feature during container startup
- Loading branch information
dharanpu
committed
Jun 13, 2018
1 parent
3b974e9
commit 5ea4c94
Showing
42 changed files
with
214 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The contents of this folder is a workaround for issues described here: https://github.com/KostyaSha/docker-java-shade/issues/1 |
5 changes: 5 additions & 0 deletions
5
.../resources/META-INF/services/org.testcontainers.dockerclient.DockerClientProviderStrategy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy | ||
org.testcontainers.dockerclient.UnixSocketClientProviderStrategy | ||
org.testcontainers.dockerclient.ProxiedUnixSocketClientProviderStrategy | ||
org.testcontainers.dockerclient.DockerMachineClientProviderStrategy | ||
org.testcontainers.dockerclient.WindowsClientProviderStrategy |
1 change: 1 addition & 0 deletions
1
...ources/META-INF/services/org.testcontainers.shaded.com.fasterxml.jackson.core.JsonFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.fasterxml.jackson.core.JsonFactory |
1 change: 1 addition & 0 deletions
1
...ources/META-INF/services/org.testcontainers.shaded.com.fasterxml.jackson.core.ObjectCodec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.fasterxml.jackson.databind.ObjectMapper |
1 change: 1 addition & 0 deletions
1
...services/org.testcontainers.shaded.com.github.dockerjava.api.command.DockerCmdExecFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl |
1 change: 1 addition & 0 deletions
1
...ion/resources/META-INF/services/org.testcontainers.shaded.javax.ws.rs.ext.RuntimeDelegate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.glassfish.jersey.internal.RuntimeDelegateImpl |
1 change: 1 addition & 0 deletions
1
...NF/services/org.testcontainers.shaded.org.glassfish.hk2.extension.ServiceLocatorGenerator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl |
1 change: 1 addition & 0 deletions
1
...rvices/org.testcontainers.shaded.org.jvnet.hk2.external.generator.ServiceLocatorGenerator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.testcontainers.shaded.org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM alpine:3.2 | ||
|
||
ADD passthrough.sh /passthrough.sh | ||
|
||
CMD /passthrough.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env sh | ||
|
||
while true; do | ||
echo "Exposing env on port 3000" | ||
env | nc -l -p 3000 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
redis: | ||
image: redis | ||
db: | ||
image: orchardup/mysql | ||
environment: | ||
MYSQL_DATABASE: wordpress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a | ||
b | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '2' | ||
services: | ||
alpine: | ||
build: compose-dockerfile | ||
environment: | ||
bar: base |
5 changes: 5 additions & 0 deletions
5
core/out/test/resources/docker-compose-non-default-override.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: '2' | ||
services: | ||
alpine: | ||
environment: | ||
bar: overwritten |
1 change: 1 addition & 0 deletions
1
core/out/test/resources/fixtures/statements/KeyValuesStatementTest/keyWithNewLinesTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"key\nwith\nnewlines"="1" |
1 change: 1 addition & 0 deletions
1
core/out/test/resources/fixtures/statements/KeyValuesStatementTest/keyWithSpacesTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"key with spaces"="1" |
1 change: 1 addition & 0 deletions
1
core/out/test/resources/fixtures/statements/KeyValuesStatementTest/keyWithTabsTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"key\twith\ttab"="1" |
3 changes: 3 additions & 0 deletions
3
core/out/test/resources/fixtures/statements/KeyValuesStatementTest/multilineTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"line1"="1" \ | ||
"line2"="2" \ | ||
"line3"="3" |
3 changes: 3 additions & 0 deletions
3
core/out/test/resources/fixtures/statements/KeyValuesStatementTest/valueIsEscapedTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"1"="value with spaces" \ | ||
"2"="value\nwith\nnewlines" \ | ||
"3"="value\twith\ttab" |
1 change: 1 addition & 0 deletions
1
core/out/test/resources/fixtures/statements/MultiArgsStatementTest/multilineTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["some\nmultiline\nargument"] |
1 change: 1 addition & 0 deletions
1
core/out/test/resources/fixtures/statements/MultiArgsStatementTest/simpleTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["a","b","c"] |
3 changes: 3 additions & 0 deletions
3
core/out/test/resources/fixtures/statements/RawStatementTest/simpleTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
value | ||
as \ | ||
is |
2 changes: 2 additions & 0 deletions
2
core/out/test/resources/fixtures/statements/SingleArgumentStatementTest/multilineTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
hello\ | ||
world |
1 change: 1 addition & 0 deletions
1
core/out/test/resources/fixtures/statements/SingleArgumentStatementTest/simpleTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello |
8 changes: 8 additions & 0 deletions
8
core/out/test/resources/health-wait-strategy-dockerfile/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM alpine:3.7 | ||
|
||
HEALTHCHECK --interval=1s CMD test -e /testfile | ||
|
||
COPY write_file_and_loop.sh write_file_and_loop.sh | ||
RUN chmod +x write_file_and_loop.sh | ||
|
||
CMD ["/write_file_and_loop.sh"] |
8 changes: 8 additions & 0 deletions
8
core/out/test/resources/health-wait-strategy-dockerfile/write_file_and_loop.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/ash | ||
|
||
echo sleeping | ||
sleep 2 | ||
echo writing file | ||
touch /testfile | ||
|
||
while true; do sleep 1; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is not a valid docker-compose file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<configuration> | ||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="debug"> | ||
<appender-ref ref="STDOUT"/> | ||
</root> | ||
|
||
<logger name="org.apache.http" level="WARN"/> | ||
<logger name="com.github.dockerjava" level="WARN"/> | ||
<logger name="org.zeroturnaround.exec" level="WARN"/> | ||
<logger name="com.zaxxer.hikari" level="INFO"/> | ||
<logger name="org.rnorth.tcpunixsocketproxy" level="INFO" /> | ||
<logger name="io.netty" level="WARN" /> | ||
<logger name="org.mongodb" level="INFO" /> | ||
<logger name="org.testcontainers.shaded" level="WARN"/> | ||
<logger name="com.zaxxer.hikari" level="INFO"/> | ||
|
||
<turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter"> | ||
<Marker>PROFILER</Marker> | ||
<OnMatch>DENY</OnMatch> | ||
</turboFilter> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM alpine:3.2 | ||
ADD folder/someFile.txt /someFile.txt | ||
RUN cat /someFile.txt | ||
ADD test.txt /test.txt | ||
RUN cat /test.txt | ||
CMD ping -c 5 www.google.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOOBAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This configuration makes Nginx listen on port port 8080 | ||
|
||
server { | ||
listen 8080; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
redis: | ||
image: redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Used for DirectoryTarResourceTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Some Test | ||
Message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '2' | ||
services: | ||
alpine: | ||
build: compose-dockerfile | ||
environment: | ||
bar: ${foo} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '2' | ||
services: | ||
redis: | ||
image: redis | ||
networks: | ||
- redis-net | ||
|
||
networks: | ||
redis-net: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: '2' | ||
services: | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
core/src/test/java/org/testcontainers/junit/CopyFileToContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.testcontainers.junit; | ||
|
||
import org.junit.Assert; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.MountableFile; | ||
import java.io.File; | ||
|
||
public class CopyFileToContainerTest { | ||
private static String folderPath = new File("./src/test/resources/mappable-resource/").getAbsolutePath(); | ||
private static String containerPath = "/tmp"; | ||
private static String fileName = "test-resource.txt"; | ||
|
||
@ClassRule | ||
public static GenericContainer container = new GenericContainer("busybox:latest") | ||
.withCopyFileToContainer(MountableFile.forHostPath(folderPath), containerPath ); | ||
|
||
@Test | ||
public void checkFileCopied() { | ||
try { | ||
String filesList = container.execInContainer("ls","/tmp").getStdout(); | ||
|
||
Assert.assertTrue(filesList.contains(fileName)); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
} |