Reduce number of CLI calls to improve startup time with devtools
Update `DockerComposeLifecycleManager` so that `docker ps` is not called multiple times. See gh-35435
This commit is contained in:
committed by
Phillip Webb
parent
b0c76c1f79
commit
6ad71c9b0c
@@ -96,26 +96,6 @@ class DefaultDockerComposeTests {
|
||||
assertThat(compose.hasDefinedServices()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void hasRunningServicesWhenPsListsRunningServiceReturnsTrue() {
|
||||
willReturn(List.of(new DockerCliComposePsResponse("id", "name", "image", "exited"),
|
||||
new DockerCliComposePsResponse("id", "name", "image", "running")))
|
||||
.given(this.cli)
|
||||
.run(new DockerCliCommand.ComposePs());
|
||||
DefaultDockerCompose compose = new DefaultDockerCompose(this.cli, HOST);
|
||||
assertThat(compose.hasRunningServices()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void hasRunningServicesWhenPsListReturnsAllExitedReturnsFalse() {
|
||||
willReturn(List.of(new DockerCliComposePsResponse("id", "name", "image", "exited"),
|
||||
new DockerCliComposePsResponse("id", "name", "image", "running")))
|
||||
.given(this.cli)
|
||||
.run(new DockerCliCommand.ComposePs());
|
||||
DefaultDockerCompose compose = new DefaultDockerCompose(this.cli, HOST);
|
||||
assertThat(compose.hasRunningServices()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRunningServicesReturnsServices() {
|
||||
String id = "123";
|
||||
|
||||
@@ -351,7 +351,6 @@ class DockerComposeLifecycleManagerTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setUpRunningServices(boolean started, Map<String, String> labels) {
|
||||
given(this.dockerCompose.hasDefinedServices()).willReturn(true);
|
||||
given(this.dockerCompose.hasRunningServices()).willReturn(true);
|
||||
RunningService runningService = mock(RunningService.class);
|
||||
given(runningService.labels()).willReturn(labels);
|
||||
this.runningServices = List.of(runningService);
|
||||
|
||||
Reference in New Issue
Block a user