Skip to content

Commit

Permalink
Lowercase identifier in DockerComposeContainer (#6944)
Browse files Browse the repository at this point in the history
According to the [docs](https://docs.docker.com/compose/environment-variables/envvars/#compose_project_name), `COMPOSE_PROJECT_NAME` must be lowescase.

Fixes #6943
  • Loading branch information
eddumelendez committed Apr 29, 2023
1 parent 1a61543 commit 6442d27
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public DockerComposeContainer(String identifier, List<File> composeFiles) {
this.dockerComposeFiles = new DockerComposeFiles(composeFiles);

// Use a unique identifier so that containers created for this compose environment can be identified
this.identifier = identifier;
this.identifier = identifier.toLowerCase();
this.project = randomProjectId();

this.dockerClient = DockerClientFactory.lazyClient();
Expand Down
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 DockerComposeV2FormatWithIdentifierTest extends BaseDockerComposeTest {

@Rule
public DockerComposeContainer environment = new DockerComposeContainer(
"TEST",
new File("src/test/resources/v2-compose-test.yml")
)
.withExposedService("redis_1", REDIS_PORT);

@Override
protected DockerComposeContainer getEnvironment() {
return this.environment;
}
}

0 comments on commit 6442d27

Please sign in to comment.