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: port changes from #7863 to 5.4.x #8409

Merged
merged 2 commits into from
Nov 23, 2021
Merged
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
24 changes: 2 additions & 22 deletions ksql-version-metrics-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,9 @@
</dependency>

<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
<version>3.10.4</version>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-client-java</artifactId>
<version>3.10.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,35 @@

package io.confluent.ksql.version.metrics;

import static org.mockserver.model.HttpRequest.request;

import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import io.confluent.ksql.version.metrics.collector.KsqlModuleType;
import io.confluent.support.metrics.BaseSupportConfig;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.apache.kafka.test.TestUtils;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;
import org.mockserver.integration.ClientAndProxy;
import org.mockserver.socket.PortFactory;

public class VersionCheckerIntegrationTest {

private static int proxyPort;
private static ClientAndProxy clientAndProxy;


@Rule
public final Timeout timeout = Timeout.builder()
.withTimeout(30, TimeUnit.SECONDS)
.withLookingForStuckThread(true)
.build();

@BeforeClass
public static void startProxy() {
proxyPort = PortFactory.findFreePort();
clientAndProxy = ClientAndProxy.startClientAndProxy(proxyPort);
}
@Rule
public WireMockRule wireMockRule = new WireMockRule(
WireMockConfiguration.wireMockConfig()
.dynamicPort()
);

@Test
public void testMetricsAgent() throws InterruptedException {
WireMock.stubFor(WireMock.post("/ksql/anon").willReturn(WireMock.ok()));

final KsqlVersionCheckerAgent versionCheckerAgent = new KsqlVersionCheckerAgent(
() -> false
Expand All @@ -57,13 +53,13 @@ public void testMetricsAgent() throws InterruptedException {
.CONFLUENT_SUPPORT_METRICS_ENDPOINT_SECURE_ENABLE_CONFIG, "false");
versionCheckProps.setProperty(
BaseSupportConfig.CONFLUENT_SUPPORT_PROXY_CONFIG,
"http://localhost:" + proxyPort
"http://localhost:" + wireMockRule.port()
);
versionCheckerAgent.start(KsqlModuleType.SERVER, versionCheckProps);

TestUtils.waitForCondition(() -> {
try {
clientAndProxy.verify(request().withPath("/ksql/anon").withMethod("POST"));
WireMock.verify(WireMock.postRequestedFor(WireMock.urlPathEqualTo("/ksql/anon")));
return true;
} catch (final AssertionError e) {
return false;
Expand Down