mirror of https://github.com/apache/kafka.git
jira: https://issues.apache.org/jira/browse/KAFKA-19382 Upgrade junit from 5.10.2 to [5.13.1](https://github.com/junit-team/junit5/releases). A new behavior was introduced to junit 5.12 (89a46dfa10
), disallowing `ClusterTestExtensions` to generate empty invocation contexts. However, `ClusterTestExtensions` is invoked by junit extension so it could result in empty contexts for some tests. ``` > Configure project : Starting build with version 4.1.0-SNAPSHOT (commit idc4a769bc
) using Gradle 8.14.1, Java 17 and Scala 2.13.16 Build properties: ignoreFailures=false, maxParallelForks=10, maxScalacThreads=8, maxTestRetries=0 > Task :core:test kafka.api.ConsumerBounceTest.initializationError failed, log available in /Users/lansg/Project/OpenSource/kafka/kafka-fork/kafka/core/build/reports/testOutput/kafka.api.ConsumerBounceTest.initializationError.test.stdout Gradle Test Run :core:test > Gradle Test Executor 5 > ConsumerBounceTest > testCloseDuringRebalance(String) > initializationError FAILED org.junit.platform.commons.PreconditionViolationException: Provider [ClusterTestExtensions] did not provide any invocation contexts, but was expected to do so. You may override mayReturnZeroTestTemplateInvocationContexts() to allow this. at java.base@17.0.13/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base@17.0.13/java.util.ArrayList.forEach(ArrayList.java:1511) kafka.api.ConsumerBounceTest.initializationError failed, log available in /Users/lansg/Project/OpenSource/kafka/kafka-fork/kafka/core/build/reports/testOutput/kafka.api.ConsumerBounceTest.initializationError.test.stdout ``` Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, TengYao Chi <frankvicky@apache.org>, Ken Huang <s7133700@gmail.com>
This commit is contained in:
parent
3a0a1705a1
commit
465b01cd2c
23
build.gradle
23
build.gradle
|
@ -2950,6 +2950,7 @@ project(':streams:upgrade-system-tests-0110') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_0110
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -2965,6 +2966,7 @@ project(':streams:upgrade-system-tests-10') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_10
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -2980,6 +2982,7 @@ project(':streams:upgrade-system-tests-11') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_11
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -2995,6 +2998,7 @@ project(':streams:upgrade-system-tests-20') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_20
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3010,6 +3014,7 @@ project(':streams:upgrade-system-tests-21') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_21
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3025,6 +3030,7 @@ project(':streams:upgrade-system-tests-22') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_22
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3040,6 +3046,7 @@ project(':streams:upgrade-system-tests-23') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_23
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3055,6 +3062,7 @@ project(':streams:upgrade-system-tests-24') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_24
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3070,6 +3078,7 @@ project(':streams:upgrade-system-tests-25') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_25
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3085,6 +3094,7 @@ project(':streams:upgrade-system-tests-26') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_26
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3100,6 +3110,7 @@ project(':streams:upgrade-system-tests-27') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_27
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3115,6 +3126,7 @@ project(':streams:upgrade-system-tests-28') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_28
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3130,6 +3142,7 @@ project(':streams:upgrade-system-tests-30') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_30
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3145,6 +3158,7 @@ project(':streams:upgrade-system-tests-31') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_31
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3160,6 +3174,7 @@ project(':streams:upgrade-system-tests-32') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_32
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3175,6 +3190,7 @@ project(':streams:upgrade-system-tests-33') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_33
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3190,6 +3206,7 @@ project(':streams:upgrade-system-tests-34') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_34
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3205,6 +3222,7 @@ project(':streams:upgrade-system-tests-35') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_35
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3220,6 +3238,7 @@ project(':streams:upgrade-system-tests-36') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_36
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3235,6 +3254,7 @@ project(':streams:upgrade-system-tests-37') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_37
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3250,6 +3270,7 @@ project(':streams:upgrade-system-tests-38') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_38
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3265,6 +3286,7 @@ project(':streams:upgrade-system-tests-39') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_39
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
@ -3280,6 +3302,7 @@ project(':streams:upgrade-system-tests-40') {
|
|||
dependencies {
|
||||
testImplementation libs.kafkaStreams_40
|
||||
testRuntimeOnly libs.junitJupiter
|
||||
testRuntimeOnly runtimeTestLibs
|
||||
}
|
||||
|
||||
systemTestLibs {
|
||||
|
|
|
@ -78,7 +78,7 @@ versions += [
|
|||
jfreechart: "1.0.0",
|
||||
jopt: "5.0.4",
|
||||
jose4j: "0.9.6",
|
||||
junit: "5.10.2",
|
||||
junit: "5.13.1",
|
||||
jqwik: "1.9.2",
|
||||
kafka_0110: "0.11.0.3",
|
||||
kafka_10: "1.0.2",
|
||||
|
@ -126,7 +126,7 @@ versions += [
|
|||
// When updating the zstd version, please do as well in docker/native/native-image-configs/resource-config.json
|
||||
// Also make sure the compression levels in org.apache.kafka.common.record.CompressionType are still valid
|
||||
zstd: "1.5.6-10",
|
||||
junitPlatform: "1.10.2",
|
||||
junitPlatform: "1.13.1",
|
||||
hdrHistogram: "2.2.2",
|
||||
hash4j: "0.22.0"
|
||||
]
|
||||
|
|
|
@ -118,6 +118,19 @@ public class ClusterTestExtensions implements TestTemplateInvocationContextProvi
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this provider may return zero test template invocation contexts.
|
||||
* Prior to JUnit 5.12, returning zero contexts was silently allowed. Starting from JUnit 5.12,
|
||||
* a PreconditionViolationException is thrown unless this method explicitly returns {@code true}.
|
||||
*
|
||||
* @param context the extension context for the test template method
|
||||
* @return {@code true} to allow this provider to return zero invocation contexts
|
||||
* @see <a href="https://github.com/junit-team/junit5/commit/89a46dfa10c6447ef010fbff7903bfcb3c18975a">JUnit 5.12 Breaking Change</a>
|
||||
*/
|
||||
public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isClusterTest(ExtensionContext context) {
|
||||
Method method = context.getRequiredTestMethod();
|
||||
return method.getDeclaredAnnotation(ClusterTemplate.class) != null ||
|
||||
|
|
Loading…
Reference in New Issue