-
-
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.
Docker Compose: allow specific services to be started (#1528)
- Loading branch information
1 parent
06ea95b
commit 7fae384
Showing
2 changed files
with
44 additions
and
1 deletion.
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
33 changes: 33 additions & 0 deletions
33
core/src/test/java/org/testcontainers/junit/DockerComposeServiceTest.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,33 @@ | ||
package org.testcontainers.junit; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.testcontainers.containers.DockerComposeContainer; | ||
|
||
import static org.rnorth.visibleassertions.VisibleAssertions.assertNotNull; | ||
|
||
import java.io.File; | ||
|
||
public class DockerComposeServiceTest extends BaseDockerComposeTest { | ||
|
||
@Rule | ||
public DockerComposeContainer environment = new DockerComposeContainer(new File("src/test/resources/compose-test.yml")) | ||
.withServices("redis") | ||
.withExposedService("redis_1", REDIS_PORT); | ||
|
||
|
||
@Override | ||
protected DockerComposeContainer getEnvironment() { | ||
return environment; | ||
} | ||
|
||
@Test(expected = NullPointerException.class) | ||
public void testDbIsNotStarting() { | ||
environment.getServicePort("db_1", 10001); | ||
} | ||
|
||
@Test | ||
public void testRedisIsStarting() { | ||
assertNotNull("Redis server started", environment.getServicePort("redis_1", REDIS_PORT)); | ||
} | ||
} |