Polish "Add property to specify Docker Compose flags"

See gh-42571
This commit is contained in:
Moritz Halbritter
2024-10-10 08:33:55 +02:00
parent 2bee29c2fd
commit dd9a998cfe
10 changed files with 48 additions and 167 deletions

View File

@@ -30,6 +30,7 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.boot.docker.compose.core.DockerCli.DockerComposeOptions;
import org.springframework.boot.docker.compose.core.DockerCliCommand.ComposeConfig;
import org.springframework.boot.docker.compose.core.DockerCliCommand.ComposeDown;
import org.springframework.boot.docker.compose.core.DockerCliCommand.ComposePs;
@@ -37,7 +38,6 @@ import org.springframework.boot.docker.compose.core.DockerCliCommand.ComposeStar
import org.springframework.boot.docker.compose.core.DockerCliCommand.ComposeStop;
import org.springframework.boot.docker.compose.core.DockerCliCommand.ComposeUp;
import org.springframework.boot.docker.compose.core.DockerCliCommand.Inspect;
import org.springframework.boot.docker.compose.core.DockerCompose.Options;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.testsupport.container.DisabledIfDockerUnavailable;
import org.springframework.boot.testsupport.container.TestImage;
@@ -72,9 +72,8 @@ class DockerCliIntegrationTests {
void runLifecycle() throws IOException {
File composeFile = createComposeFile("redis-compose.yaml");
String projectName = UUID.randomUUID().toString();
Options options = Options.get(DockerComposeFile.of(composeFile), Collections.emptySet(),
List.of("--project-name=" + projectName));
DockerCli cli = new DockerCli(null, options);
DockerCli cli = new DockerCli(null, new DockerComposeOptions(DockerComposeFile.of(composeFile),
Collections.emptySet(), List.of("--project-name=" + projectName)));
try {
// Verify that no services are running (this is a fresh compose project)
List<DockerCliComposePsResponse> ps = cli.run(new ComposePs());
@@ -113,8 +112,8 @@ class DockerCliIntegrationTests {
@Test
void shouldWorkWithMultipleComposeFiles() throws IOException {
List<File> composeFiles = createComposeFiles();
Options options = Options.get(DockerComposeFile.of(composeFiles), Set.of("dev"), Collections.emptyList());
DockerCli cli = new DockerCli(null, options);
DockerCli cli = new DockerCli(null,
new DockerComposeOptions(DockerComposeFile.of(composeFiles), Set.of("dev"), Collections.emptyList()));
try {
// List the config and verify that both redis are there
DockerCliComposeConfigResponse config = cli.run(new ComposeConfig());

View File

@@ -1,6 +1,6 @@
services:
redis1:
profiles: [ dev ]
profiles: [ 'dev' ]
image: '{imageName}'
ports:
- '6379'

View File

@@ -1,6 +1,6 @@
services:
redis3:
profiles: [ prod ]
profiles: [ 'prod' ]
image: '{imageName}'
ports:
- '6379'