Merge branch '3.1.x'
Closes gh-37991
This commit is contained in:
@@ -46,7 +46,7 @@ class DefaultDockerComposeTests {
|
||||
|
||||
private static final String HOST = "192.168.1.1";
|
||||
|
||||
private DockerCli cli = mock(DockerCli.class);
|
||||
private final DockerCli cli = mock(DockerCli.class);
|
||||
|
||||
@Test
|
||||
void upRunsUpCommand() {
|
||||
@@ -141,4 +141,20 @@ class DefaultDockerComposeTests {
|
||||
assertThat(runningService.host()).isEqualTo("192.168.1.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void worksWithTruncatedIds() {
|
||||
String shortId = "123";
|
||||
String longId = "123456";
|
||||
DockerCliComposePsResponse psResponse = new DockerCliComposePsResponse(shortId, "name", "redis", "running");
|
||||
Config config = new Config("redis", Collections.emptyMap(), Collections.emptyMap(), Collections.emptyList());
|
||||
DockerCliInspectResponse inspectResponse = new DockerCliInspectResponse(longId, config, null, null);
|
||||
willReturn(List.of(new DockerCliContextResponse("test", true, "https://192.168.1.1"))).given(this.cli)
|
||||
.run(new DockerCliCommand.Context());
|
||||
willReturn(List.of(psResponse)).given(this.cli).run(new DockerCliCommand.ComposePs());
|
||||
willReturn(List.of(inspectResponse)).given(this.cli).run(new DockerCliCommand.Inspect(List.of(shortId)));
|
||||
DefaultDockerCompose compose = new DefaultDockerCompose(this.cli, null);
|
||||
List<RunningService> runningServices = compose.getRunningServices();
|
||||
assertThat(runningServices).hasSize(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class DockerCliIntegrationTests {
|
||||
String id = ps.get(0).id();
|
||||
List<DockerCliInspectResponse> inspect = cli.run(new Inspect(List.of(id)));
|
||||
assertThat(inspect).isNotEmpty();
|
||||
assertThat(inspect.get(0).id()).isEqualTo(id);
|
||||
assertThat(inspect.get(0).id()).startsWith(id);
|
||||
// Run stop, then run ps and verify the services are stopped
|
||||
cli.run(new ComposeStop(Duration.ofSeconds(10)));
|
||||
ps = cli.run(new ComposePs());
|
||||
|
||||
Reference in New Issue
Block a user