-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker-compose-rule now adds (opt in) support for docker-compose v2
- Loading branch information
1 parent
916c91a
commit 98c4b39
Showing
20 changed files
with
249 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: feature | ||
feature: | ||
description: docker-compose-rule now adds (opt in) support for docker-compose v2 | ||
links: | ||
- https://github.com/palantir/docker-compose-rule/pull/722 |
54 changes: 54 additions & 0 deletions
54
...grationTest/java/com/palantir/docker/compose/DockerComposeExtensionV2IntegrationTest.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,54 @@ | ||
/* | ||
* (c) Copyright 2019 Palantir Technologies Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.palantir.docker.compose; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.palantir.docker.compose.configuration.DockerComposeFiles; | ||
import com.palantir.docker.compose.connection.waiting.HealthChecks; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
public class DockerComposeExtensionV2IntegrationTest { | ||
|
||
@RegisterExtension | ||
public static final DockerComposeExtension docker = DockerComposeExtension.builder() | ||
.files(DockerComposeFiles.from("src/integrationTest/resources/docker-compose.yaml")) | ||
.waitingForService("db", HealthChecks.toHaveAllPortsOpen()) | ||
.waitingForService("db2", HealthChecks.toHaveAllPortsOpen()) | ||
.waitingForService("db3", HealthChecks.toHaveAllPortsOpen()) | ||
.waitingForService("db4", HealthChecks.toHaveAllPortsOpen()) | ||
.useDockerComposeV2(true) | ||
.build(); | ||
|
||
private static int port; | ||
|
||
@Test | ||
@Order(1) | ||
public void an_external_port_exists() { | ||
port = docker.containers().container("db").port(5432).getExternalPort(); | ||
assertThat(port).isNotZero(); | ||
} | ||
|
||
@Test | ||
@Order(2) | ||
public void container_stays_up_between_tests() { | ||
assertThat(docker.containers().container("db").port(5432).getExternalPort()) | ||
.isEqualTo(port); | ||
} | ||
} |
43 changes: 23 additions & 20 deletions
43
docker-compose-junit-jupiter/src/integrationTest/resources/docker-compose.yaml
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 |
---|---|---|
@@ -1,23 +1,26 @@ | ||
db: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" | ||
version: '2.1' | ||
|
||
db2: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" | ||
services: | ||
db: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" | ||
|
||
db3: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" | ||
db2: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" | ||
|
||
db4: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" | ||
db3: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" | ||
|
||
db4: | ||
image: appropriate/nc | ||
command: /bin/sh -c 'echo server started && nc -lk 5432' | ||
ports: | ||
- "5432" |
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
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
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
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
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
Oops, something went wrong.