-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 18, 2018
1 parent
3b974e9
commit 871f47c
Showing
5 changed files
with
67 additions
and
3 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
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
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
package org.testcontainers.junit; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.MountableFile; | ||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
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"; | ||
|
||
@Test | ||
public void checkFileCopied() throws IOException, InterruptedException { | ||
try( | ||
GenericContainer container = new GenericContainer("alpine:latest") | ||
.withCommand("sleep","3000") | ||
.withCopyFileToContainer(MountableFile.forHostPath(folderPath), containerPath) | ||
) { | ||
container.start(); | ||
String filesList = container.execInContainer("ls","/tmp/mappable-resource").getStdout(); | ||
Assert.assertTrue(filesList.contains(fileName)); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -26,4 +26,4 @@ | |
<Marker>PROFILER</Marker> | ||
<OnMatch>DENY</OnMatch> | ||
</turboFilter> | ||
</configuration> | ||
</configuration> |