Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests to support ProxyConnectionFactory #881

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public void before() throws Exception {
server = application.createServer();
server.start();
baseUri = server.getURI();
if (certificates != null && baseUri.getScheme().equals("http")) {
// If PROXY protocol is enabled, the base URI will come back as http because the first connection
// factory is not the SSL factory. If we want SSL, explicitly set the scheme here
baseUri = new URI(baseUri.toString().replace("http", "https"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We have loaded the JAX-RS classes for Kafka REST, so it might be a tad nicer to use javax.ws.rs.core.UriBuilder here:

baseUri = UriBuilder.fromUri(baseUri).scheme("https").build();

}
}

private KafkaRestConfig createConfigs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public void before() throws Exception {
server = new SchemaRegistryRestApplication(createConfigs()).createServer();
server.start();
baseUri = server.getURI();
if (certificates != null && baseUri.getScheme().equals("http")) {
// If PROXY protocol is enabled, the base URI will come back as http because the first connection
// factory is not the SSL factory. If we want SSL, explicitly set the scheme here
baseUri = new URI(baseUri.toString().replace("http", "https"));
}
client =
new CachedSchemaRegistryClient(
singletonList(baseUri.toString()),
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<parent>
<groupId>io.confluent</groupId>
<artifactId>rest-utils-parent</artifactId>
<version>[7.1.0-0, 7.1.1-0)</version>
<version>7.1.0-0</version>
<!-- <version>[7.1.0-0, 7.1.1-0)</version> -->
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to submit that temporarily? If yes, can you please add a comment explaining why? If not, is that a leftover from some testing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is just so that it will consume the rest-utils local changes when running tests, I'll get rid of it before I convert this to a real PR.

</parent>

<artifactId>kafka-rest-parent</artifactId>
Expand Down