diff --git a/build.gradle b/build.gradle index a3f1965f81a..b4e9cbb8011 100644 --- a/build.gradle +++ b/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 { diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index d20e3da69ab..cf519c4af8f 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -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" ] diff --git a/test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/junit/ClusterTestExtensions.java b/test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/junit/ClusterTestExtensions.java index de81a6b82bd..f08abdb32aa 100644 --- a/test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/junit/ClusterTestExtensions.java +++ b/test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/junit/ClusterTestExtensions.java @@ -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 JUnit 5.12 Breaking Change + */ + public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext context) { + return true; + } + private boolean isClusterTest(ExtensionContext context) { Method method = context.getRequiredTestMethod(); return method.getDeclaredAnnotation(ClusterTemplate.class) != null ||