-
-
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.
- Loading branch information
1 parent
196d180
commit 337e0c7
Showing
3 changed files
with
75 additions
and
5 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
32 changes: 32 additions & 0 deletions
32
core/src/test/java/org/testcontainers/junit/ComposeServiceTest.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,32 @@ | ||
package org.testcontainers.junit; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.testcontainers.containers.ComposeContainer; | ||
|
||
import java.io.File; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class ComposeServiceTest extends BaseComposeTest { | ||
|
||
@Rule | ||
public ComposeContainer environment = new ComposeContainer(new File("src/test/resources/compose-v2-test.yml")) | ||
.withServices("redis") | ||
.withExposedService("redis-1", REDIS_PORT); | ||
|
||
@Override | ||
protected ComposeContainer getEnvironment() { | ||
return this.environment; | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void testDbIsNotStarting() { | ||
this.environment.getServicePort("db-1", 10001); | ||
} | ||
|
||
@Test | ||
public void testRedisIsStarting() { | ||
assertThat(this.environment.getServicePort("redis-1", REDIS_PORT)).as("Redis server started").isNotNull(); | ||
} | ||
} |
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,7 @@ | ||
services: | ||
redis: | ||
image: redis | ||
db: | ||
image: mysql:5.7.34 | ||
environment: | ||
MYSQL_RANDOM_ROOT_PASSWORD: "true" |