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

Bump Kafka version to 3.6.0 and use the latest kafka containers in the testsuite #205

Merged
merged 1 commit into from
Oct 5, 2023
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
7 changes: 6 additions & 1 deletion .travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if [ "$arch" == 's390x' ]; then
mvn test-compile spotbugs:check -e -V -B -f testsuite
set +e
clearDockerEnv
mvn -e -V -B clean install -f testsuite -Pcustom -Dkafka.docker.image=quay.io/strimzi/kafka:0.33.2-kafka-3.4.0
mvn -e -V -B clean install -f testsuite -Pcustom -Dkafka.docker.image=quay.io/strimzi/kafka:0.37.0-kafka-3.5.0
EXIT=$?
exitIfError
set -e
Expand All @@ -64,6 +64,11 @@ elif [[ "$arch" != 'ppc64le' ]]; then

set +e

clearDockerEnv
mvn -e -V -B clean install -f testsuite -Pkafka-3_5_0
EXIT=$?
exitIfError

clearDockerEnv
mvn -e -V -B clean install -f testsuite -Pkafka-3_4_0
EXIT=$?
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<maven.resources.version>3.3.0</maven.resources.version>
<spotbugs.version>4.7.3</spotbugs.version>
<sonatype.nexus.staging>1.6.3</sonatype.nexus.staging>
<kafka.version>3.5.0</kafka.version>
<kafka.version>3.6.0</kafka.version>
<jackson.version>2.15.2</jackson.version>
<jackson.databind.version>2.15.2</jackson.databind.version>
<jsonpath.version>2.8.0</jsonpath.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,12 @@ public static int countLogForRegex(List<String> log, String regex) {
}
return count;
}

public static Throwable getRootCause(Throwable e) {
Throwable cause = e;
while (cause != null && cause.getCause() != null) {
cause = cause.getCause();
}
return cause == e ? null : cause;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static io.strimzi.testsuite.oauth.auth.Common.buildProducerConfigOAuthBearer;
import static io.strimzi.testsuite.oauth.auth.Common.buildProducerConfigPlain;
import static io.strimzi.testsuite.oauth.common.TestUtil.getContainerLogsForString;
import static io.strimzi.testsuite.oauth.common.TestUtil.getRootCause;

public class ErrorReportingTests {

Expand Down Expand Up @@ -463,7 +464,7 @@ private void cantConnectKeycloakWithTimeout() {
} catch (Exception e) {
long diff = System.currentTimeMillis() - start;
Assert.assertTrue("is instanceof KafkaException", e instanceof KafkaException);
Assert.assertTrue("Failed due to LoginException", e.getCause().toString().contains("LoginException"));
Assert.assertTrue("Failed due to LoginException", getRootCause(e).toString().contains("LoginException"));
Assert.assertTrue("Unexpected diff: " + diff, diff > timeout * 1000 && diff < timeout * 1000 + 1000);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static io.strimzi.testsuite.oauth.common.TestUtil.getContainerLogsForString;
import static io.strimzi.testsuite.oauth.mockoauth.Common.buildProducerConfigOAuthBearer;
import static io.strimzi.testsuite.oauth.mockoauth.Common.changeAuthServerMode;
import static io.strimzi.testsuite.oauth.common.TestUtil.getRootCause;

public class ConnectTimeoutTests {

Expand Down Expand Up @@ -98,7 +99,7 @@ private void connectAuthServerWithTimeout() throws Exception {
} catch (Exception e) {
long diff = System.currentTimeMillis() - start;
Assert.assertTrue("is instanceof KafkaException", e instanceof KafkaException);
Assert.assertTrue("Failed due to LoginException", e.getCause().toString().contains("LoginException"));
Assert.assertTrue("Failed due to LoginException", getRootCause(e).toString().contains("LoginException"));
Assert.assertTrue("Unexpected diff: " + diff, diff > timeoutOverride * 1000 && diff < timeoutOverride * 1000 + 1000);
} finally {
changeAuthServerMode("token", "mode_200");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.Properties;
import java.util.concurrent.ExecutionException;

import static io.strimzi.testsuite.oauth.common.TestUtil.getRootCause;


public class JaasClientConfigTest {

Expand Down Expand Up @@ -305,7 +307,7 @@ private void assertConfigException(Throwable e, String message) {
Throwable cause = e.getCause();
Assert.assertEquals("is a KafkaException", KafkaException.class, e.getClass());

Throwable nestedCause = cause.getCause();
Throwable nestedCause = getRootCause(cause);
Assert.assertEquals("is a ConfigException", ConfigException.class, nestedCause.getClass());
Assert.assertTrue("Contains '" + message + "'", nestedCause.getMessage().contains(message));
}
Expand All @@ -314,7 +316,7 @@ private void assertLoginException(Throwable e) {
Throwable cause = e.getCause();
Assert.assertEquals("is a KafkaException", KafkaException.class, e.getClass());

Throwable nestedCause = cause.getCause();
Throwable nestedCause = getRootCause(cause);
Assert.assertEquals("is a LoginException", LoginException.class, nestedCause.getClass());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static io.strimzi.testsuite.oauth.mockoauth.Common.buildProducerConfigPlain;
import static io.strimzi.testsuite.oauth.mockoauth.Common.changeAuthServerMode;
import static io.strimzi.testsuite.oauth.mockoauth.Common.createOAuthClient;
import static io.strimzi.testsuite.oauth.common.TestUtil.getRootCause;
import static io.strimzi.testsuite.oauth.mockoauth.Common.loginWithClientSecret;

public class RetriesTests {
Expand Down Expand Up @@ -123,7 +124,7 @@ private void testClientRetries() throws Exception {
// get the exception

Assert.assertTrue("is instanceof KafkaException", e instanceof KafkaException);
Assert.assertTrue("Failed due to LoginException", e.getCause().toString().contains("LoginException"));
Assert.assertTrue("Failed due to LoginException", getRootCause(e).toString().contains("LoginException"));
}

// repeat, it should succeed
Expand Down
9 changes: 8 additions & 1 deletion testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<strimzi-oauth.version>1.0.0-SNAPSHOT</strimzi-oauth.version>
<checkstyle.dir>..</checkstyle.dir>

<kafka.docker.image>quay.io/strimzi/kafka:0.35.1-kafka-3.4.0</kafka.docker.image>
<kafka.docker.image>quay.io/strimzi/kafka:0.37.0-kafka-3.5.0</kafka.docker.image>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -417,6 +417,13 @@
<kafka.docker.image>quay.io/strimzi/kafka:0.35.1-kafka-3.4.0</kafka.docker.image>
</properties>
</profile>
<profile>
<id>kafka-3_5_0</id>
<properties>
<!-- Uses JDK 17.0.x -->
<kafka.docker.image>quay.io/strimzi/kafka:0.37.0-kafka-3.5.0</kafka.docker.image>
</properties>
</profile>
<profile>
<!--
When using this profile you can use -Dkafka.docker.image=YOUR_IMAGE
Expand Down