com.palantir.docker.compose.configuration.DockerComposeFiles Java Examples
The following examples show how to use
com.palantir.docker.compose.configuration.DockerComposeFiles.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContainerIntegrationTests.java From docker-compose-rule with Apache License 2.0 | 6 votes |
/** * This test is not currently enabled in Circle as it does not provide a sufficiently recent version of docker-compose. * * @see <a href="https://github.com/palantir/docker-compose-rule/issues/156">Issue #156</a> */ @Test public void testStateChanges_withHealthCheck() throws IOException, InterruptedException { assumeThat("docker version", Docker.version(), new GreaterOrEqual<>(Version.forIntegers(1, 12, 0))); assumeThat("docker-compose version", DockerCompose.version(), new GreaterOrEqual<>(Version.forIntegers(1, 10, 0))); DockerCompose dockerCompose = new DefaultDockerCompose( DockerComposeFiles.from("src/test/resources/native-healthcheck.yaml"), dockerMachine, ProjectName.random()); // The withHealthcheck service's healthcheck checks every 100ms whether the file "healthy" exists Container container = new Container("withHealthcheck", docker, dockerCompose); assertEquals(State.DOWN, container.state()); container.up(); assertEquals(State.UNHEALTHY, container.state()); dockerCompose.exec(noOptions(), "withHealthcheck", arguments("touch", "healthy")); wait.until(container::state, equalTo(State.HEALTHY)); dockerCompose.exec(noOptions(), "withHealthcheck", arguments("rm", "healthy")); wait.until(container::state, equalTo(State.UNHEALTHY)); container.kill(); assertEquals(State.DOWN, container.state()); }
Example #2
Source File: DefaultDockerCompose.java From docker-compose-rule with Apache License 2.0 | 5 votes |
public DefaultDockerCompose(DockerComposeFiles dockerComposeFiles, DockerMachine dockerMachine, ProjectName projectName) { this(DockerComposeExecutable.builder() .dockerComposeFiles(dockerComposeFiles) .dockerConfiguration(dockerMachine) .projectName(projectName) .build(), dockerMachine); }
Example #3
Source File: ContainerIntegrationTests.java From docker-compose-rule with Apache License 2.0 | 5 votes |
@Test public void testStateChanges_withoutHealthCheck() throws IOException, InterruptedException { DockerCompose dockerCompose = new DefaultDockerCompose( DockerComposeFiles.from("src/test/resources/no-healthcheck.yaml"), dockerMachine, ProjectName.random()); // The noHealthcheck service has no healthcheck specified; it should be immediately healthy Container container = new Container("noHealthcheck", docker, dockerCompose); Assert.assertEquals(State.DOWN, container.state()); container.up(); assertEquals(State.HEALTHY, container.state()); container.kill(); assertEquals(State.DOWN, container.state()); }
Example #4
Source File: DockerComposeFactory.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
public static Extension startDockerCompose(Path tempFolder) { if (DockerComposeFactoryProperties.isDockerComposeDisabled()) { return (BeforeAllCallback) context -> logger.info("Docker Compose installation is disabled!"); } logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_DATAFLOW_VERSIONN, DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_DATAFLOW_VERSIONN, DEFAULT_DATAFLOW_VERSION)); logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_SKIPPER_VERSIONN, DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_SKIPPER_VERSIONN, DEFAULT_SKIPPER_VERSION)); logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_STREAM_APPS_URI, DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_STREAM_APPS_URI, DEFAULT_STREAM_APPS_URI)); logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_TASK_APPS_URI, DockerComposeFactoryProperties.get(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_TASK_APPS_URI, DEFAULT_TASK_APPS_URI)); logger.info("{} = {}", DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_PATHS, DockerComposeFactoryProperties.getDockerComposePaths(DEFAULT_DOCKER_COMPOSE_PATHS)); String[] dockerComposePaths = new ResourceExtractor(tempFolder).extract( DockerComposeFactoryProperties.getDockerComposePaths(DEFAULT_DOCKER_COMPOSE_PATHS)); logger.info("Extracted docker compose files = {}", Arrays.toString(dockerComposePaths)); return DockerComposeExtension.builder() .files(DockerComposeFiles.from(dockerComposePaths)) .machine(dockerMachine) .saveLogsTo("target/dockerLogs/DockerComposeIT") .waitingForService("dataflow-server", HealthChecks.toRespond2xxOverHttp(9393, (port) -> port.inFormat("http://$HOST:$EXTERNAL_PORT")), org.joda.time.Duration.standardMinutes(10)) .waitingForService("skipper-server", HealthChecks.toRespond2xxOverHttp(7577, (port) -> port.inFormat("http://$HOST:$EXTERNAL_PORT")), org.joda.time.Duration.standardMinutes(10)) // set to false to test with local dataflow and skipper images. .pullOnStartup(DockerComposeFactoryProperties.getBoolean(DockerComposeFactoryProperties.TEST_DOCKER_COMPOSE_PULLONSTARTUP, true)) .build(); }
Example #5
Source File: DockerComposeManager.java From docker-compose-rule with Apache License 2.0 | 4 votes |
default TSelf file(String dockerComposeYmlFile) { return files(DockerComposeFiles.from(dockerComposeYmlFile)); }
Example #6
Source File: DockerComposeManager.java From docker-compose-rule with Apache License 2.0 | votes |
public abstract DockerComposeFiles files();
Example #7
Source File: DockerComposeExecutable.java From docker-compose-rule with Apache License 2.0 | votes |
@Value.Parameter protected abstract DockerComposeFiles dockerComposeFiles();