-
-
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.
Fix Docker compose stop command by adding environment (#8493)
This issue was introduced in 7112db5. `DockerComposeContainer` and `ComposeContainer` now passes the env to the stop command in both implementations. Fixes #8492 --------- Signed-off-by: Michael Musenbrock <michael.musenbrock@gmail.com> Co-authored-by: Eddú Meléndez Gonzales <eddu.melendez@gmail.com>
- Loading branch information
1 parent
eadc9d6
commit e2b2d85
Showing
5 changed files
with
49 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
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
21 changes: 21 additions & 0 deletions
21
core/src/test/java/org/testcontainers/junit/ComposeContainerPortViaEnvTest.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,21 @@ | ||
package org.testcontainers.junit; | ||
|
||
import org.junit.Rule; | ||
import org.testcontainers.containers.ComposeContainer; | ||
|
||
import java.io.File; | ||
|
||
public class ComposeContainerPortViaEnvTest extends BaseComposeTest { | ||
|
||
@Rule | ||
public ComposeContainer environment = new ComposeContainer( | ||
new File("src/test/resources/v2-compose-test-port-via-env.yml") | ||
) | ||
.withExposedService("redis-1", REDIS_PORT) | ||
.withEnv("REDIS_PORT", String.valueOf(REDIS_PORT)); | ||
|
||
@Override | ||
protected ComposeContainer getEnvironment() { | ||
return environment; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
core/src/test/java/org/testcontainers/junit/DockerComposeContainerPortViaEnvTest.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,21 @@ | ||
package org.testcontainers.junit; | ||
|
||
import org.junit.Rule; | ||
import org.testcontainers.containers.DockerComposeContainer; | ||
|
||
import java.io.File; | ||
|
||
public class DockerComposeContainerPortViaEnvTest extends BaseDockerComposeTest { | ||
|
||
@Rule | ||
public DockerComposeContainer environment = new DockerComposeContainer( | ||
new File("src/test/resources/v2-compose-test-port-via-env.yml") | ||
) | ||
.withExposedService("redis_1", REDIS_PORT) | ||
.withEnv("REDIS_PORT", String.valueOf(REDIS_PORT)); | ||
|
||
@Override | ||
protected DockerComposeContainer getEnvironment() { | ||
return environment; | ||
} | ||
} |
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 @@ | ||
services: | ||
redis: | ||
image: redis | ||
ports: | ||
- ${REDIS_PORT} |