-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
169 additions
and
312 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: fix | ||
fix: | ||
description: Jdk21 support (round 2) | ||
links: | ||
- https://github.com/palantir/docker-proxy-rule/pull/576 |
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
135 changes: 135 additions & 0 deletions
135
...k21/src/integrationTest/java/com/palantir/docker/proxy/DockerProxyExtensionJdk21Test.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,135 @@ | ||
/* | ||
* (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.proxy; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; | ||
|
||
import com.palantir.docker.compose.DockerComposeExtension; | ||
import com.palantir.docker.compose.connection.Container; | ||
import com.palantir.docker.compose.logging.LogDirectory; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
class DockerProxyExtensionJdk21Test { | ||
@RegisterExtension | ||
static final DockerComposeExtension DOCKER_COMPOSE_EXTENSION = DockerComposeExtension.builder() | ||
.file("src/integrationTest/resources/DockerProxyExtensionJdk21Test-services.yml") | ||
.saveLogsTo(LogDirectory.circleAwareLogDirectory(DockerProxyExtensionJdk21Test.class)) | ||
.waitingForService("webserver", Container::areAllPortsOpen) | ||
.build(); | ||
|
||
@Test | ||
void canReachDockerContainerByContainerNameWithProjectSpecified() throws IOException, InterruptedException { | ||
DockerProxyExtension dockerProxyExtension = DockerProxyExtension.fromProjectName( | ||
DOCKER_COMPOSE_EXTENSION.projectName(), DockerProxyExtensionJdk21Test.class); | ||
try { | ||
dockerProxyExtension.before(); | ||
URLConnection urlConnection = new URL("http://webserver").openConnection(); | ||
urlConnection.connect(); | ||
} finally { | ||
dockerProxyExtension.after(); | ||
} | ||
} | ||
|
||
@Test | ||
void canReachDockerContainerByHostnameWithProjectSpecified() throws IOException, InterruptedException { | ||
DockerProxyExtension dockerProxyExtension = DockerProxyExtension.fromProjectName( | ||
DOCKER_COMPOSE_EXTENSION.projectName(), DockerProxyExtensionJdk21Test.class); | ||
try { | ||
dockerProxyExtension.before(); | ||
URLConnection urlConnection = new URL("http://web").openConnection(); | ||
urlConnection.connect(); | ||
} finally { | ||
dockerProxyExtension.after(); | ||
} | ||
} | ||
|
||
@Test | ||
void canReachDockerContainerByHostnameAndDomainNameWithProjectSpecified() throws IOException, InterruptedException { | ||
DockerProxyExtension dockerProxyExtension = DockerProxyExtension.fromProjectName( | ||
DOCKER_COMPOSE_EXTENSION.projectName(), DockerProxyExtensionJdk21Test.class); | ||
try { | ||
dockerProxyExtension.before(); | ||
URLConnection urlConnection = new URL("http://web.server.here").openConnection(); | ||
urlConnection.connect(); | ||
} finally { | ||
dockerProxyExtension.after(); | ||
} | ||
} | ||
|
||
@Test | ||
void canReachDockerContainerByContainerNameWithNetworkSpecified() throws IOException, InterruptedException { | ||
DockerProxyExtension dockerProxyExtension = DockerProxyExtension.fromNetworkName( | ||
DOCKER_COMPOSE_EXTENSION.projectName().asString() + "_default", DockerProxyExtensionJdk21Test.class); | ||
try { | ||
dockerProxyExtension.before(); | ||
URLConnection urlConnection = new URL("http://webserver").openConnection(); | ||
urlConnection.connect(); | ||
} finally { | ||
dockerProxyExtension.after(); | ||
} | ||
} | ||
|
||
@Test | ||
void canReachDockerContainerByHostnameWithNetworkSpecified() throws IOException, InterruptedException { | ||
DockerProxyExtension dockerProxyExtension = DockerProxyExtension.fromNetworkName( | ||
DOCKER_COMPOSE_EXTENSION.projectName().asString() + "_default", DockerProxyExtensionJdk21Test.class); | ||
try { | ||
dockerProxyExtension.before(); | ||
URLConnection urlConnection = new URL("http://web").openConnection(); | ||
urlConnection.connect(); | ||
} finally { | ||
dockerProxyExtension.after(); | ||
} | ||
} | ||
|
||
@Test | ||
void canReachDockerContainerByHostnameAndDomainNameWithNetworkSpecified() throws IOException, InterruptedException { | ||
DockerProxyExtension dockerProxyExtension = DockerProxyExtension.fromNetworkName( | ||
DOCKER_COMPOSE_EXTENSION.projectName().asString() + "_default", DockerProxyExtensionJdk21Test.class); | ||
try { | ||
dockerProxyExtension.before(); | ||
URLConnection urlConnection = new URL("http://web.server.here").openConnection(); | ||
urlConnection.connect(); | ||
} finally { | ||
dockerProxyExtension.after(); | ||
} | ||
} | ||
|
||
@Test | ||
void otherHostnamesStillResolve() throws IOException, InterruptedException { | ||
DockerProxyExtension dockerProxyExtension = DockerProxyExtension.fromProjectName( | ||
DOCKER_COMPOSE_EXTENSION.projectName(), DockerProxyExtensionJdk21Test.class); | ||
try { | ||
dockerProxyExtension.before(); | ||
URLConnection urlConnection = new URL("http://www.palantir.com").openConnection(); | ||
urlConnection.connect(); | ||
} finally { | ||
dockerProxyExtension.after(); | ||
} | ||
} | ||
|
||
@Test | ||
void runningProxyRuleBeforeDockerComposeRuleFails() { | ||
assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> DockerProxyExtension.fromNetworkName( | ||
"doesnotexist", DockerProxyExtensionJdk21Test.class) | ||
.before()); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...-rule-core-jdk21/src/integrationTest/resources/DockerProxyExtensionJdk21Test-services.yml
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,7 @@ | ||
version: '2' | ||
|
||
services: | ||
webserver: | ||
hostname: web | ||
domainname: server.here | ||
image: nginx |
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
1 change: 0 additions & 1 deletion
1
...-core-jdk21/src/main/resources/META-INF/services/java.net.spi.InetAddressResolverProvider
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
...rule-core-jdk21/src/test/java/com/palantir/docker/proxy/DockerContainerInfoUtilsTest.java
This file was deleted.
Oops, something went wrong.
107 changes: 0 additions & 107 deletions
107
...-proxy-rule-core-jdk21/src/test/java/com/palantir/docker/proxy/DockerNameServiceTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.