Search in sources :

Example 1 with DockerHost

use of org.springframework.boot.buildpack.platform.docker.configuration.DockerHost in project spring-boot by spring-projects.

the class DockerSpecTests method asDockerConfigurationWithHostConfiguration.

@Test
void asDockerConfigurationWithHostConfiguration() {
    DockerSpec dockerSpec = new DockerSpec();
    dockerSpec.setHost("docker.example.com");
    dockerSpec.setTlsVerify(true);
    dockerSpec.setCertPath("/tmp/ca-cert");
    DockerConfiguration dockerConfiguration = dockerSpec.asDockerConfiguration();
    DockerHost host = dockerConfiguration.getHost();
    assertThat(host.getAddress()).isEqualTo("docker.example.com");
    assertThat(host.isSecure()).isEqualTo(true);
    assertThat(host.getCertificatePath()).isEqualTo("/tmp/ca-cert");
    assertThat(dockerSpec.asDockerConfiguration().getBuilderRegistryAuthentication()).isNull();
    assertThat(dockerSpec.asDockerConfiguration().getPublishRegistryAuthentication()).isNull();
}
Also used : DockerConfiguration(org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration) DockerHost(org.springframework.boot.buildpack.platform.docker.configuration.DockerHost) Test(org.junit.jupiter.api.Test)

Example 2 with DockerHost

use of org.springframework.boot.buildpack.platform.docker.configuration.DockerHost in project spring-boot by spring-projects.

the class DockerSpecTests method asDockerConfigurationWithHostConfigurationNoTlsVerify.

@Test
void asDockerConfigurationWithHostConfigurationNoTlsVerify() {
    DockerSpec dockerSpec = new DockerSpec();
    dockerSpec.setHost("docker.example.com");
    DockerConfiguration dockerConfiguration = dockerSpec.asDockerConfiguration();
    DockerHost host = dockerConfiguration.getHost();
    assertThat(host.getAddress()).isEqualTo("docker.example.com");
    assertThat(host.isSecure()).isEqualTo(false);
    assertThat(host.getCertificatePath()).isNull();
    assertThat(dockerSpec.asDockerConfiguration().getBuilderRegistryAuthentication()).isNull();
    assertThat(dockerSpec.asDockerConfiguration().getPublishRegistryAuthentication()).isNull();
}
Also used : DockerConfiguration(org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration) DockerHost(org.springframework.boot.buildpack.platform.docker.configuration.DockerHost) Test(org.junit.jupiter.api.Test)

Example 3 with DockerHost

use of org.springframework.boot.buildpack.platform.docker.configuration.DockerHost in project spring-boot by spring-projects.

the class RemoteHttpClientTransportTests method createIfPossibleWhenDockerHostIsNotSetReturnsNull.

@Test
void createIfPossibleWhenDockerHostIsNotSetReturnsNull() {
    RemoteHttpClientTransport transport = RemoteHttpClientTransport.createIfPossible(this.environment::get, new DockerHost(null, false, null));
    assertThat(transport).isNull();
}
Also used : DockerHost(org.springframework.boot.buildpack.platform.docker.configuration.DockerHost) Test(org.junit.jupiter.api.Test)

Example 4 with DockerHost

use of org.springframework.boot.buildpack.platform.docker.configuration.DockerHost in project spring-boot by spring-projects.

the class RemoteHttpClientTransportTests method createIfPossibleWhenDockerHostInConfigurationIsAddressReturnsTransport.

@Test
void createIfPossibleWhenDockerHostInConfigurationIsAddressReturnsTransport() {
    RemoteHttpClientTransport transport = RemoteHttpClientTransport.createIfPossible(this.environment::get, new DockerHost("tcp://192.168.1.2:2376", false, null));
    assertThat(transport).isNotNull();
}
Also used : DockerHost(org.springframework.boot.buildpack.platform.docker.configuration.DockerHost) Test(org.junit.jupiter.api.Test)

Example 5 with DockerHost

use of org.springframework.boot.buildpack.platform.docker.configuration.DockerHost in project spring-boot by spring-projects.

the class RemoteHttpClientTransportTests method createIfPossibleWhenDockerHostInConfigurationIsFileReturnsNull.

@Test
void createIfPossibleWhenDockerHostInConfigurationIsFileReturnsNull(@TempDir Path tempDir) throws IOException {
    String dummySocketFilePath = Files.createTempFile(tempDir, "remote-transport", null).toAbsolutePath().toString();
    RemoteHttpClientTransport transport = RemoteHttpClientTransport.createIfPossible(this.environment::get, new DockerHost(dummySocketFilePath, false, null));
    assertThat(transport).isNull();
}
Also used : DockerHost(org.springframework.boot.buildpack.platform.docker.configuration.DockerHost) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)6 DockerHost (org.springframework.boot.buildpack.platform.docker.configuration.DockerHost)6 DockerConfiguration (org.springframework.boot.buildpack.platform.docker.configuration.DockerConfiguration)3