From 4b2278ff9c8c6a02be8a40005ee3ed593e1c7112 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Sun, 7 Apr 2024 16:43:16 +0300 Subject: [PATCH] MINOR: Default test name added to core (#15667) Reviewers: Chia-Ping Tsai --- .../test/resources/junit-platform.properties | 15 ++ .../admin/BrokerApiVersionsCommandTest.scala | 4 +- .../admin/ConfigCommandIntegrationTest.scala | 8 +- .../admin/ListOffsetsIntegrationTest.scala | 18 +- .../kafka/admin/RemoteTopicCrudTest.scala | 34 +-- ...minClientWithPoliciesIntegrationTest.scala | 8 +- .../kafka/api/AuthorizerIntegrationTest.scala | 196 +++++++++--------- .../kafka/api/BaseProducerSendTest.scala | 20 +- .../integration/kafka/api/BaseQuotaTest.scala | 12 +- ...thLegacyMessageFormatIntegrationTest.scala | 5 +- ...gationTokenEndToEndAuthorizationTest.scala | 2 +- ...enEndToEndAuthorizationWithOwnerTest.scala | 6 +- .../kafka/api/EndToEndAuthorizationTest.scala | 20 +- .../api/GroupAuthorizerIntegrationTest.scala | 6 +- .../api/GroupCoordinatorIntegrationTest.scala | 4 +- .../kafka/api/LogAppendTimeTest.scala | 4 +- .../api/PlaintextAdminIntegrationTest.scala | 116 +++++------ .../PlaintextEndToEndAuthorizationTest.scala | 3 +- .../kafka/api/PlaintextProducerSendTest.scala | 20 +- .../api/ProducerFailureHandlingTest.scala | 22 +- .../kafka/api/ProducerIdExpirationTest.scala | 8 +- .../api/ProducerSendWhileDeletionTest.scala | 4 +- .../api/SaslEndToEndAuthorizationTest.scala | 4 +- .../api/SaslMultiMechanismConsumerTest.scala | 4 +- ...aslScramSslEndToEndAuthorizationTest.scala | 2 +- .../kafka/api/TransactionsBounceTest.scala | 6 +- .../api/TransactionsExpirationTest.scala | 6 +- .../kafka/api/TransactionsTest.scala | 40 ++-- .../TransactionsWithMaxInFlightOneTest.scala | 4 +- .../network/DynamicConnectionQuotaTest.scala | 10 +- .../DynamicNumNetworkThreadsTest.scala | 4 +- .../DynamicBrokerReconfigurationTest.scala | 16 +- .../FetchFromFollowerIntegrationTest.scala | 10 +- .../tools/MirrorMakerIntegrationTest.scala | 8 +- .../scala/kafka/utils/TestInfoUtils.scala | 1 - .../unit/kafka/admin/AddPartitionsTest.scala | 16 +- .../unit/kafka/admin/DeleteTopicTest.scala | 20 +- .../UserScramCredentialsCommandTest.scala | 7 +- ...tricsDuringTopicCreationDeletionTest.scala | 4 +- .../kafka/integration/MinIsrConfigTest.scala | 4 +- .../unit/kafka/metrics/MetricsTest.scala | 28 +-- .../security/authorizer/AuthorizerTest.scala | 58 +++--- .../AddPartitionsToTxnRequestServerTest.scala | 4 +- ...AlterUserScramCredentialsRequestTest.scala | 18 +- .../server/CreateTopicsRequestTest.scala | 14 +- .../CreateTopicsRequestWithPolicyTest.scala | 5 +- ...legationTokenRequestsOnPlainTextTest.scala | 3 +- .../server/DelegationTokenRequestsTest.scala | 4 +- ...nRequestsWithDisableTokenFeatureTest.scala | 4 +- .../server/DeleteRecordsRequestTest.scala | 7 +- .../server/DeleteTopicsRequestTest.scala | 10 +- ...opicsRequestWithDeletionDisabledTest.scala | 2 +- .../server/DescribeClusterRequestTest.scala | 5 +- ...mCredentialsRequestNotAuthorizedTest.scala | 3 +- ...cribeUserScramCredentialsRequestTest.scala | 8 +- .../server/DynamicConfigChangeTest.scala | 34 +-- .../kafka/server/EdgeCaseRequestTest.scala | 10 +- ...FetchRequestDownConversionConfigTest.scala | 6 +- .../server/FetchRequestMaxBytesTest.scala | 4 +- .../unit/kafka/server/FetchRequestTest.scala | 32 +-- ...aMetricReporterExceptionHandlingTest.scala | 4 +- .../server/KafkaMetricsReporterTest.scala | 4 +- .../unit/kafka/server/LogDirFailureTest.scala | 12 +- .../unit/kafka/server/LogRecoveryTest.scala | 11 +- .../kafka/server/MetadataRequestTest.scala | 32 +-- .../OffsetsForLeaderEpochRequestTest.scala | 6 +- .../kafka/server/ProduceRequestTest.scala | 10 +- .../unit/kafka/server/ReplicaFetchTest.scala | 4 +- .../kafka/server/ReplicaManagerTest.scala | 6 +- .../kafka/server/ReplicationQuotasTest.scala | 8 +- .../unit/kafka/server/RequestQuotaTest.scala | 14 +- .../kafka/server/ServerShutdownTest.scala | 16 +- .../epoch/LeaderEpochIntegrationTest.scala | 8 +- 73 files changed, 549 insertions(+), 546 deletions(-) create mode 100644 core/src/test/resources/junit-platform.properties diff --git a/core/src/test/resources/junit-platform.properties b/core/src/test/resources/junit-platform.properties new file mode 100644 index 0000000000000..05069923a7f21 --- /dev/null +++ b/core/src/test/resources/junit-platform.properties @@ -0,0 +1,15 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +junit.jupiter.params.displayname.default = "{displayName}.{argumentsWithNames}" diff --git a/core/src/test/scala/integration/kafka/admin/BrokerApiVersionsCommandTest.scala b/core/src/test/scala/integration/kafka/admin/BrokerApiVersionsCommandTest.scala index 06ee92ff968c4..6cd6959c7e240 100644 --- a/core/src/test/scala/integration/kafka/admin/BrokerApiVersionsCommandTest.scala +++ b/core/src/test/scala/integration/kafka/admin/BrokerApiVersionsCommandTest.scala @@ -19,7 +19,7 @@ package kafka.admin import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.NodeApiVersions import org.apache.kafka.common.message.ApiMessageType import org.apache.kafka.common.protocol.ApiKeys @@ -59,7 +59,7 @@ class BrokerApiVersionsCommandTest extends KafkaServerTestHarness { } @Timeout(120) - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def checkBrokerApiVersionCommandOutput(quorum: String): Unit = { val byteArrayOutputStream = new ByteArrayOutputStream diff --git a/core/src/test/scala/integration/kafka/admin/ConfigCommandIntegrationTest.scala b/core/src/test/scala/integration/kafka/admin/ConfigCommandIntegrationTest.scala index 22e4be47579bc..abc8881f69968 100644 --- a/core/src/test/scala/integration/kafka/admin/ConfigCommandIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/admin/ConfigCommandIntegrationTest.scala @@ -19,7 +19,7 @@ package kafka.admin import kafka.admin.ConfigCommand.ConfigCommandOptions import kafka.cluster.{Broker, EndPoint} import kafka.server.{KafkaConfig, QuorumTestHarness} -import kafka.utils.{Exit, Logging, TestInfoUtils} +import kafka.utils.{Exit, Logging} import kafka.zk.{AdminZkClient, BrokerInfo} import org.apache.kafka.common.config.ConfigException import org.apache.kafka.common.network.ListenerName @@ -35,7 +35,7 @@ import scala.jdk.CollectionConverters._ class ConfigCommandIntegrationTest extends QuorumTestHarness with Logging { - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def shouldExitWithNonZeroStatusOnUpdatingUnallowedConfigViaZk(quorum: String): Unit = { assertNonZeroStatusExit(Array( @@ -46,7 +46,7 @@ class ConfigCommandIntegrationTest extends QuorumTestHarness with Logging { "--add-config", "security.inter.broker.protocol=PLAINTEXT")) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def shouldExitWithNonZeroStatusOnZkCommandAlterUserQuota(quorum: String): Unit = { assertNonZeroStatusExit(Array( @@ -74,7 +74,7 @@ class ConfigCommandIntegrationTest extends QuorumTestHarness with Logging { assertEquals(Some(1), exitStatus) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testDynamicBrokerConfigUpdateUsingZooKeeper(quorum: String): Unit = { val brokerId = "1" diff --git a/core/src/test/scala/integration/kafka/admin/ListOffsetsIntegrationTest.scala b/core/src/test/scala/integration/kafka/admin/ListOffsetsIntegrationTest.scala index 5362a1d5e35c9..e5a26d8f118b9 100644 --- a/core/src/test/scala/integration/kafka/admin/ListOffsetsIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/admin/ListOffsetsIntegrationTest.scala @@ -20,7 +20,7 @@ package kafka.admin import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig import kafka.utils.TestUtils.{createProducer, plaintextBootstrapServers} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin._ import org.apache.kafka.clients.producer.ProducerRecord import org.apache.kafka.common.TopicPartition @@ -61,7 +61,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThreeCompressedRecordsInOneBatch(quorum: String): Unit = { produceMessagesInOneBatch("gzip") @@ -75,7 +75,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { verifyListOffsets(topic = topicNameWithCustomConfigs, 0) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThreeNonCompressedRecordsInOneBatch(quorum: String): Unit = { produceMessagesInOneBatch() @@ -90,7 +90,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { verifyListOffsets(topic = topicNameWithCustomConfigs, 0) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThreeNonCompressedRecordsInSeparateBatch(quorum: String): Unit = { produceMessagesInSeparateBatch() @@ -104,7 +104,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { } // The message conversion test only run in ZK mode because KRaft mode doesn't support "inter.broker.protocol.version" < 3.0 - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testThreeRecordsInOneBatchWithMessageConversion(quorum: String): Unit = { createOldMessageFormatBrokers() @@ -120,7 +120,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { } // The message conversion test only run in ZK mode because KRaft mode doesn't support "inter.broker.protocol.version" < 3.0 - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testThreeRecordsInSeparateBatchWithMessageConversion(quorum: String): Unit = { createOldMessageFormatBrokers() @@ -135,7 +135,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { verifyListOffsets(topic = topicNameWithCustomConfigs, 2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThreeRecordsInOneBatchHavingDifferentCompressionTypeWithServer(quorum: String): Unit = { val props: Properties = new Properties() @@ -145,7 +145,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { verifyListOffsets(topic = topicNameWithCustomConfigs) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThreeRecordsInSeparateBatchHavingDifferentCompressionTypeWithServer(quorum: String): Unit = { val props: Properties = new Properties() @@ -155,7 +155,7 @@ class ListOffsetsIntegrationTest extends KafkaServerTestHarness { verifyListOffsets(topic = topicNameWithCustomConfigs) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThreeCompressedRecordsInSeparateBatch(quorum: String): Unit = { produceMessagesInSeparateBatch("gzip") diff --git a/core/src/test/scala/integration/kafka/admin/RemoteTopicCrudTest.scala b/core/src/test/scala/integration/kafka/admin/RemoteTopicCrudTest.scala index 7b21ef8268616..e7f3282431d83 100644 --- a/core/src/test/scala/integration/kafka/admin/RemoteTopicCrudTest.scala +++ b/core/src/test/scala/integration/kafka/admin/RemoteTopicCrudTest.scala @@ -18,7 +18,7 @@ package kafka.admin import kafka.api.IntegrationTestHarness import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.{AlterConfigOp, ConfigEntry} import org.apache.kafka.common.{TopicIdPartition, TopicPartition, Uuid} import org.apache.kafka.common.config.{ConfigException, ConfigResource, TopicConfig} @@ -72,7 +72,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { testTopicName = s"${info.getTestMethod.get().getName}-${Random.alphanumeric.take(10).mkString}" } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateRemoteTopicWithValidRetentionTime(quorum: String): Unit = { val topicConfig = new Properties() @@ -84,7 +84,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { verifyRemoteLogTopicConfigs(topicConfig) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateRemoteTopicWithValidRetentionSize(quorum: String): Unit = { val topicConfig = new Properties() @@ -96,7 +96,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { verifyRemoteLogTopicConfigs(topicConfig) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateRemoteTopicWithInheritedLocalRetentionTime(quorum: String): Unit = { // inherited local retention ms is 1000 @@ -108,7 +108,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { verifyRemoteLogTopicConfigs(topicConfig) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateRemoteTopicWithInheritedLocalRetentionSize(quorum: String): Unit = { // inherited local retention bytes is 1024 @@ -120,7 +120,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { verifyRemoteLogTopicConfigs(topicConfig) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateRemoteTopicWithInvalidRetentionTime(quorum: String): Unit = { // inherited local retention ms is 1000 @@ -132,7 +132,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { topicConfig = topicConfig)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateRemoteTopicWithInvalidRetentionSize(quorum: String): Unit = { // inherited local retention bytes is 1024 @@ -144,7 +144,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { topicConfig = topicConfig)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateCompactedRemoteStorage(quorum: String): Unit = { val topicConfig = new Properties() @@ -155,7 +155,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { topicConfig = topicConfig)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testEnableRemoteLogOnExistingTopicTest(quorum: String): Unit = { val admin = createAdminClient() @@ -173,7 +173,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { verifyRemoteLogTopicConfigs(topicConfig) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testEnableRemoteLogWhenSystemRemoteStorageIsDisabled(quorum: String): Unit = { val admin = createAdminClient() @@ -197,7 +197,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { assertTrue(errorMessage.getMessage.contains("Tiered Storage functionality is disabled in the broker")) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUpdateTopicConfigWithValidRetentionTimeTest(quorum: String): Unit = { val admin = createAdminClient() @@ -218,7 +218,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { verifyRemoteLogTopicConfigs(topicConfig) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUpdateTopicConfigWithValidRetentionSizeTest(quorum: String): Unit = { val admin = createAdminClient() @@ -239,7 +239,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { verifyRemoteLogTopicConfigs(topicConfig) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUpdateTopicConfigWithInheritedLocalRetentionTime(quorum: String): Unit = { val admin = createAdminClient() @@ -259,7 +259,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { () => admin.incrementalAlterConfigs(configs).all().get()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUpdateTopicConfigWithInheritedLocalRetentionSize(quorum: String): Unit = { val admin = createAdminClient() @@ -279,7 +279,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { () => admin.incrementalAlterConfigs(configs).all().get(), "Invalid local retention size") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTopicDeletion(quorum: String): Unit = { MyRemoteStorageManager.deleteSegmentEventCounter.set(0) @@ -298,7 +298,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { "Remote log segments should be deleted only once by the leader") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClusterWideDisablementOfTieredStorageWithEnabledTieredTopic(quorum: String): Unit = { val topicConfig = new Properties() @@ -320,7 +320,7 @@ class RemoteTopicCrudTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClusterWithoutTieredStorageStartsSuccessfullyIfTopicWithTieringDisabled(quorum: String): Unit = { val topicConfig = new Properties() diff --git a/core/src/test/scala/integration/kafka/api/AdminClientWithPoliciesIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/AdminClientWithPoliciesIntegrationTest.scala index b3236abd989bc..6b1e31c29bf8f 100644 --- a/core/src/test/scala/integration/kafka/api/AdminClientWithPoliciesIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/api/AdminClientWithPoliciesIntegrationTest.scala @@ -18,7 +18,7 @@ import java.util.Properties import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig import kafka.utils.TestUtils.assertFutureExceptionTypeEquals -import kafka.utils.{Logging, TestInfoUtils, TestUtils} +import kafka.utils.{Logging, TestUtils} import org.apache.kafka.clients.admin.AlterConfigOp.OpType import org.apache.kafka.clients.admin.{Admin, AdminClientConfig, AlterConfigOp, AlterConfigsOptions, Config, ConfigEntry} import org.apache.kafka.common.config.{ConfigResource, TopicConfig} @@ -78,7 +78,7 @@ class AdminClientWithPoliciesIntegrationTest extends KafkaServerTestHarness with props.put(KafkaConfig.AlterConfigPolicyClassNameProp, classOf[Policy]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testValidAlterConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -97,7 +97,7 @@ class AdminClientWithPoliciesIntegrationTest extends KafkaServerTestHarness with PlaintextAdminIntegrationTest.checkValidAlterConfigs(client, this, topicResource1, topicResource2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidAlterConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -105,7 +105,7 @@ class AdminClientWithPoliciesIntegrationTest extends KafkaServerTestHarness with } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidAlterConfigsDueToPolicy(quorum: String): Unit = { client = Admin.create(createConfig) diff --git a/core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala index edee6a1de2d49..6ef6af9b5ec07 100644 --- a/core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala @@ -18,7 +18,7 @@ import java.util import java.util.concurrent.ExecutionException import java.util.regex.Pattern import java.util.{Collections, Optional, Properties} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import kafka.utils.TestUtils.waitUntilTrue import org.apache.kafka.clients.admin.{Admin, AlterConfigOp, NewTopic} import org.apache.kafka.clients.consumer._ @@ -646,7 +646,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizationWithTopicExisting(quorum: String): Unit = { //First create the topic so we have a valid topic ID @@ -700,7 +700,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { /* * even if the topic doesn't exist, request APIs should not leak the topic name */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizationWithTopicNotExisting(quorum: String): Unit = { val id = Uuid.randomUuid() @@ -725,7 +725,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRequests(requestKeyToRequest, false, topicNames) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @CsvSource(value = Array("zk,false", "zk,true", "kraft,false", "kraft,true")) def testTopicIdAuthorization(quorum: String, withTopicExisting: Boolean): Unit = { val topicId = if (withTopicExisting) { @@ -778,7 +778,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { /* * even if the topic doesn't exist, request APIs should not leak the topic name */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizationFetchV12WithTopicNotExisting(quorum: String): Unit = { val id = Uuid.ZERO_UUID @@ -790,7 +790,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRequests(requestKeyToRequest, false, topicNames) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateTopicAuthorizationWithClusterCreate(quorum: String): Unit = { removeAllClientAcls() @@ -803,7 +803,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRequestAndVerifyResponseError(createTopicsRequest, resources, isAuthorized = true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testFetchFollowerRequest(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -823,7 +823,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRequestAndVerifyResponseError(request, resources, isAuthorized = true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIncrementalAlterConfigsRequestRequiresClusterPermissionForBrokerLogger(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -847,7 +847,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRequestAndVerifyResponseError(request, resources, isAuthorized = true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetsForLeaderEpochClusterPermission(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -866,7 +866,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRequestAndVerifyResponseError(request, resources, isAuthorized = true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceWithNoTopicAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -874,7 +874,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => sendRecords(producer, numRecords, tp)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceWithTopicDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -883,7 +883,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => sendRecords(producer, numRecords, tp)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceWithTopicRead(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -892,7 +892,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => sendRecords(producer, numRecords, tp)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceWithTopicWrite(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -901,13 +901,13 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRecords(producer, numRecords, tp) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreatePermissionOnTopicToWriteToNonExistentTopic(quorum: String): Unit = { testCreatePermissionNeededToWriteToNonExistentTopic(TOPIC) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreatePermissionOnClusterToWriteToNonExistentTopic(quorum: String): Unit = { testCreatePermissionNeededToWriteToNonExistentTopic(CLUSTER) @@ -926,7 +926,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { sendRecords(producer, numRecords, tp) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumeUsingAssignWithNoAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -941,7 +941,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => consumeRecords(consumer)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSimpleConsumeWithOffsetLookupAndNoGroupAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -961,7 +961,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(group, e.groupId()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSimpleConsumeWithExplicitSeekAndNoGroupAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -981,7 +981,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { consumeRecords(consumer) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumeWithoutTopicDescribeAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -999,7 +999,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Collections.singleton(topic), e.unauthorizedTopics()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumeWithTopicDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1018,7 +1018,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Collections.singleton(topic), e.unauthorizedTopics()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumeWithTopicWrite(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1037,7 +1037,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Collections.singleton(topic), e.unauthorizedTopics()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumeWithTopicAndGroupRead(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1056,7 +1056,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPatternSubscriptionWithNoTopicAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1074,7 +1074,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertTrue(consumer.subscription.isEmpty) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPatternSubscriptionWithTopicDescribeOnlyAndGroupRead(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1093,7 +1093,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPatternSubscriptionWithTopicAndGroupRead(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1126,7 +1126,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPatternSubscriptionMatchingInternalTopic(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1156,7 +1156,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPatternSubscriptionMatchingInternalTopicWithDescribeOnlyPermission(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1182,7 +1182,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Collections.singleton(GROUP_METADATA_TOPIC_NAME), e.unauthorizedTopics()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPatternSubscriptionNotMatchingInternalTopic(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1201,7 +1201,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { consumeRecords(consumer) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreatePermissionOnTopicToReadFromNonExistentTopic(quorum: String): Unit = { testCreatePermissionNeededToReadFromNonExistentTopic("newTopic", @@ -1209,7 +1209,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { TOPIC) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreatePermissionOnClusterToReadFromNonExistentTopic(quorum: String): Unit = { testCreatePermissionNeededToReadFromNonExistentTopic("newTopic", @@ -1242,7 +1242,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { }, "Partition metadata not propagated.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreatePermissionMetadataRequestAutoCreate(quorum: String): Unit = { val readAcls = topicReadAcl(topicResource) @@ -1264,14 +1264,14 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitWithNoAccess(quorum: String): Unit = { val consumer = createConsumer() assertThrows(classOf[GroupAuthorizationException], () => consumer.commitSync(Map(tp -> new OffsetAndMetadata(5)).asJava)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitWithNoTopicAccess(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, READ, ALLOW)), groupResource) @@ -1279,7 +1279,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => consumer.commitSync(Map(tp -> new OffsetAndMetadata(5)).asJava)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitWithTopicWrite(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1290,7 +1290,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => consumer.commitSync(Map(tp -> new OffsetAndMetadata(5)).asJava)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitWithTopicDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1301,7 +1301,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => consumer.commitSync(Map(tp -> new OffsetAndMetadata(5)).asJava)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitWithNoGroupAccess(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, READ, ALLOW)), topicResource) @@ -1309,7 +1309,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[GroupAuthorizationException], () => consumer.commitSync(Map(tp -> new OffsetAndMetadata(5)).asJava)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitWithTopicAndGroupRead(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1319,7 +1319,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { consumer.commitSync(Map(tp -> new OffsetAndMetadata(5)).asJava) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetFetchWithNoAccess(quorum: String): Unit = { val consumer = createConsumer() @@ -1327,7 +1327,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => consumer.position(tp)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetFetchWithNoGroupAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1337,7 +1337,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[GroupAuthorizationException], () => consumer.position(tp)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetFetchWithNoTopicAccess(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, READ, ALLOW)), groupResource) @@ -1346,7 +1346,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TopicAuthorizationException], () => consumer.position(tp)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetFetchAllTopicPartitionsAuthorization(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1378,7 +1378,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(offset, offsetFetchResponse.partitionDataMap(group).get(tp).offset) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetFetchMultipleGroupsAuthorization(quorum: String): Unit = { val groups: Seq[String] = (1 to 5).map(i => s"group$i") @@ -1534,7 +1534,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { ) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetFetchTopicDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1545,7 +1545,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { consumer.position(tp) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetFetchWithTopicAndGroupRead(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1556,14 +1556,14 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { consumer.position(tp) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMetadataWithNoTopicAccess(quorum: String): Unit = { val consumer = createConsumer() assertThrows(classOf[TopicAuthorizationException], () => consumer.partitionsFor(topic)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMetadataWithTopicDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1572,14 +1572,14 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { consumer.partitionsFor(topic) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testListOffsetsWithNoTopicAccess(quorum: String): Unit = { val consumer = createConsumer() assertThrows(classOf[TopicAuthorizationException], () => consumer.endOffsets(Set(tp).asJava)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testListOffsetsWithTopicDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1588,7 +1588,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { consumer.endOffsets(Set(tp).asJava) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeGroupApiWithNoGroupAcl(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, DESCRIBE, ALLOW)), topicResource) @@ -1596,7 +1596,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { TestUtils.assertFutureExceptionTypeEquals(result.describedGroups().get(group), classOf[GroupAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeGroupApiWithGroupDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1605,7 +1605,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { createAdminClient().describeConsumerGroups(Seq(group).asJava).describedGroups().get(group).get() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testListGroupApiWithAndWithoutListGroupAcls(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1654,7 +1654,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { otherConsumer.close() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteGroupApiWithDeleteGroupAcl(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1668,7 +1668,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { createAdminClient().deleteConsumerGroups(Seq(group).asJava).deletedGroups().get(group).get() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteGroupApiWithNoDeleteGroupAcl(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1682,14 +1682,14 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { TestUtils.assertFutureExceptionTypeEquals(result.deletedGroups().get(group), classOf[GroupAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteGroupApiWithNoDeleteGroupAcl2(quorum: String): Unit = { val result = createAdminClient().deleteConsumerGroups(Seq(group).asJava) TestUtils.assertFutureExceptionTypeEquals(result.deletedGroups().get(group), classOf[GroupAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteGroupOffsetsWithAcl(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1705,7 +1705,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertNull(result.partitionResult(tp).get()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteGroupOffsetsWithoutDeleteAcl(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1720,7 +1720,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { TestUtils.assertFutureExceptionTypeEquals(result.all(), classOf[GroupAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteGroupOffsetsWithDeleteAclWithoutTopicAcl(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1741,21 +1741,21 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { TestUtils.assertFutureExceptionTypeEquals(result.partitionResult(tp), classOf[TopicAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteGroupOffsetsWithNoAcl(quorum: String): Unit = { val result = createAdminClient().deleteConsumerGroupOffsets(group, Set(tp).asJava) TestUtils.assertFutureExceptionTypeEquals(result.all(), classOf[GroupAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnauthorizedDeleteTopicsWithoutDescribe(quorum: String): Unit = { val deleteResponse = connectAndReceive[DeleteTopicsResponse](deleteTopicsRequest) assertEquals(Errors.TOPIC_AUTHORIZATION_FAILED.code, deleteResponse.data.responses.find(topic).errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnauthorizedDeleteTopicsWithDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1764,7 +1764,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Errors.TOPIC_AUTHORIZATION_FAILED.code, deleteResponse.data.responses.find(topic).errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteTopicsWithWildCardAuth(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1773,7 +1773,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Errors.NONE.code, deleteResponse.data.responses.find(topic).errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnauthorizedDeleteRecordsWithoutDescribe(quorum: String): Unit = { val deleteRecordsResponse = connectAndReceive[DeleteRecordsResponse](deleteRecordsRequest) @@ -1781,7 +1781,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { partitions.asScala.head.errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnauthorizedDeleteRecordsWithDescribe(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1791,7 +1791,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { partitions.asScala.head.errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteRecordsWithWildCardAuth(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1801,14 +1801,14 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { partitions.asScala.head.errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnauthorizedCreatePartitions(quorum: String): Unit = { val createPartitionsResponse = connectAndReceive[CreatePartitionsResponse](createPartitionsRequest) assertEquals(Errors.TOPIC_AUTHORIZATION_FAILED.code, createPartitionsResponse.data.results.asScala.head.errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreatePartitionsWithWildCardAuth(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1817,7 +1817,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Errors.NONE.code, createPartitionsResponse.data.results.asScala.head.errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionalProducerInitTransactionsNoWriteTransactionalIdAcl(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, DESCRIBE, ALLOW)), transactionalIdResource) @@ -1825,14 +1825,14 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TransactionalIdAuthorizationException], () => producer.initTransactions()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionalProducerInitTransactionsNoDescribeTransactionalIdAcl(quorum: String): Unit = { val producer = buildTransactionalProducer() assertThrows(classOf[TransactionalIdAuthorizationException], () => producer.initTransactions()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendOffsetsWithNoConsumerGroupDescribeAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1848,7 +1848,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { () => producer.sendOffsetsToTransaction(Map(tp -> new OffsetAndMetadata(0L)).asJava, new ConsumerGroupMetadata(group))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendOffsetsWithNoConsumerGroupWriteAccess(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1863,7 +1863,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { () => producer.sendOffsetsToTransaction(Map(tp -> new OffsetAndMetadata(0L)).asJava, new ConsumerGroupMetadata(group))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIdempotentProducerNoIdempotentWriteAclInInitProducerId(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1902,7 +1902,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertClusterAuthFailure() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIdempotentProducerNoIdempotentWriteAclInProduce(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1931,7 +1931,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertTrue(e.getCause.isInstanceOf[TopicAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldInitTransactionsWhenAclSet(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, WRITE, ALLOW)), transactionalIdResource) @@ -1939,7 +1939,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { producer.initTransactions() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionalProducerTopicAuthorizationExceptionInSendCallback(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1956,7 +1956,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Set(topic), e.unauthorizedTopics.asScala) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionalProducerTopicAuthorizationExceptionInCommit(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1974,7 +1974,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { }) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldThrowTransactionalIdAuthorizationExceptionWhenNoTransactionAccessDuringSend(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -1989,7 +1989,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { JTestUtils.assertFutureThrows(future, classOf[TransactionalIdAuthorizationException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldThrowTransactionalIdAuthorizationExceptionWhenNoTransactionAccessOnEndTransaction(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2004,7 +2004,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertThrows(classOf[TransactionalIdAuthorizationException], () => producer.commitTransaction()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testListTransactionsAuthorization(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2038,7 +2038,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertListTransactionResult(expectedTransactionalIds = Set(transactionalId)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldNotIncludeUnauthorizedTopicsInDescribeTransactionsResponse(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2061,7 +2061,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(List.empty, transactionStateData.topics.asScala.toList) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldSuccessfullyAbortTransactionAfterTopicAuthorizationException(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2081,7 +2081,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { producer.abortTransaction() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldThrowTransactionalIdAuthorizationExceptionWhenNoTransactionAccessOnSendOffsetsToTxn(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, WRITE, ALLOW)), transactionalIdResource) @@ -2097,7 +2097,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { }) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldSendSuccessfullyWhenIdempotentAndHasCorrectACL(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2108,7 +2108,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } // Verify that metadata request without topics works without any ACLs and returns cluster id - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClusterId(quorum: String): Unit = { val request = new requests.MetadataRequest.Builder(List.empty.asJava, false).build() @@ -2117,7 +2117,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertFalse(response.clusterId.isEmpty, "Cluster id not returned") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testRetryProducerInitializationAfterPermissionFix(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2141,7 +2141,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { producer.close() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizeByResourceTypeMultipleAddAndRemove(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2159,7 +2159,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizeByResourceTypeIsolationUnrelatedDenyWontDominateAllow(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2182,7 +2182,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertIdempotentSendSuccess() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizeByResourceTypeDenyTakesPrecedence(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2195,7 +2195,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertIdempotentSendAuthorizationFailure() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizeByResourceTypeWildcardResourceDenyDominate(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2213,7 +2213,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertIdempotentSendAuthorizationFailure() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizeByResourceTypePrefixedResourceDenyDominate(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2227,7 +2227,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertIdempotentSendAuthorizationFailure() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMetadataClusterAuthorizedOperationsWithoutDescribeCluster(quorum: String): Unit = { removeAllClientAcls() @@ -2238,7 +2238,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMetadataClusterAuthorizedOperationsWithDescribeAndAlterCluster(quorum: String): Unit = { removeAllClientAcls() @@ -2259,7 +2259,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeTopicAclWithOperationAll(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2284,7 +2284,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { assertEquals(Errors.NONE, topicResponse.error) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeTopicConfigsAclWithOperationAll(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2324,7 +2324,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeClusterClusterAuthorizedOperationsWithoutDescribeCluster(quorum: String): Unit = { removeAllClientAcls() @@ -2334,7 +2334,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeClusterClusterAuthorizedOperationsWithDescribeAndAlterCluster(quorum: String): Unit = { removeAllClientAcls() @@ -2354,7 +2354,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testHostAddressBasedAcls(quorum: String): Unit = { createTopicWithBrokerPrincipal(topic) @@ -2388,7 +2388,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateAndCloseConsumerWithNoAccess(quorum: String): Unit = { val consumer = createConsumer() @@ -2524,7 +2524,7 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { ) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPrefixAcls(quorum: String): Unit = { addAndVerifyAcls(Set(new AccessControlEntry(clientPrincipalString, WILDCARD_HOST, CREATE, ALLOW)), diff --git a/core/src/test/scala/integration/kafka/api/BaseProducerSendTest.scala b/core/src/test/scala/integration/kafka/api/BaseProducerSendTest.scala index 93f7a7212c497..02902b56f7a98 100644 --- a/core/src/test/scala/integration/kafka/api/BaseProducerSendTest.scala +++ b/core/src/test/scala/integration/kafka/api/BaseProducerSendTest.scala @@ -23,7 +23,7 @@ import java.util.{Collections, Properties} import java.util.concurrent.TimeUnit import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.{Admin, NewPartitions} import org.apache.kafka.clients.consumer.Consumer import org.apache.kafka.clients.producer._ @@ -124,7 +124,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { * 1. Send with null key/value/partition-id should be accepted; send with null topic should be rejected. * 2. Last message of the non-blocking send should return the correct offset metadata */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendOffset(quorum: String): Unit = { val producer = createProducer() @@ -186,7 +186,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendCompressedMessageWithCreateTime(quorum: String): Unit = { val producer = createProducer( @@ -196,7 +196,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { sendAndVerifyTimestamp(producer, TimestampType.CREATE_TIME) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendNonCompressedMessageWithCreateTime(quorum: String): Unit = { val producer = createProducer(lingerMs = Int.MaxValue, deliveryTimeoutMs = Int.MaxValue) @@ -289,7 +289,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { * * After close() returns, all messages should be sent with correct returned offset metadata */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClose(quorum: String): Unit = { val producer = createProducer() @@ -323,7 +323,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { * * The specified partition-id should be respected */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendToPartition(quorum: String): Unit = { val producer = createProducer() @@ -416,7 +416,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { * Producer will attempt to send messages to the partition specified in each record, and should * succeed as long as the partition is included in the metadata. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendBeforeAndAfterPartitionExpansion(quorum: String): Unit = { val producer = createProducer(maxBlockMs = 5 * 1000L) @@ -474,7 +474,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { /** * Test that flush immediately sends all accumulated requests. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testFlush(quorum: String): Unit = { val producer = createProducer(lingerMs = Int.MaxValue, deliveryTimeoutMs = Int.MaxValue) @@ -496,7 +496,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { /** * Test close with zero timeout from caller thread */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCloseWithZeroTimeoutFromCallerThread(quorum: String): Unit = { TestUtils.createTopicWithAdmin(admin, topic, brokers, controllerServers, 2, 2) @@ -522,7 +522,7 @@ abstract class BaseProducerSendTest extends KafkaServerTestHarness { /** * Test close with zero and non-zero timeout from sender thread */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCloseWithZeroTimeoutFromSenderThread(quorum: String): Unit = { TestUtils.createTopicWithAdmin(admin, topic, brokers, controllerServers, 1, 2) diff --git a/core/src/test/scala/integration/kafka/api/BaseQuotaTest.scala b/core/src/test/scala/integration/kafka/api/BaseQuotaTest.scala index 74e6756090c94..0a526ca25a095 100644 --- a/core/src/test/scala/integration/kafka/api/BaseQuotaTest.scala +++ b/core/src/test/scala/integration/kafka/api/BaseQuotaTest.scala @@ -20,7 +20,7 @@ import java.util.{Collections, HashMap, Properties} import com.yammer.metrics.core.{Histogram, Meter} import kafka.api.QuotaTestClients._ import kafka.server.{ClientQuotaManager, KafkaBroker, KafkaConfig, QuotaType} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.Admin import org.apache.kafka.clients.consumer.{Consumer, ConsumerConfig} import org.apache.kafka.clients.producer._ @@ -87,7 +87,7 @@ abstract class BaseQuotaTest extends IntegrationTestHarness { quotaTestClients = createQuotaTestClients(topic1, leaderNode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThrottledProducerConsumer(quorum: String): Unit = { val numRecords = 1000 @@ -99,7 +99,7 @@ abstract class BaseQuotaTest extends IntegrationTestHarness { quotaTestClients.verifyConsumeThrottle(expectThrottle = true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProducerConsumerOverrideUnthrottled(quorum: String): Unit = { // Give effectively unlimited quota for producer and consumer @@ -119,7 +119,7 @@ abstract class BaseQuotaTest extends IntegrationTestHarness { quotaTestClients.verifyConsumeThrottle(expectThrottle = false) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProducerConsumerOverrideLowerQuota(quorum: String): Unit = { // consumer quota is set such that consumer quota * default quota window (10 seconds) is less than @@ -137,7 +137,7 @@ abstract class BaseQuotaTest extends IntegrationTestHarness { quotaTestClients.verifyConsumeThrottle(expectThrottle = true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testQuotaOverrideDelete(quorum: String): Unit = { // Override producer and consumer quotas to unlimited @@ -164,7 +164,7 @@ abstract class BaseQuotaTest extends IntegrationTestHarness { quotaTestClients.verifyConsumeThrottle(expectThrottle = true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testThrottledRequest(quorum: String): Unit = { quotaTestClients.overrideQuotas(Long.MaxValue, Long.MaxValue, 0.1) diff --git a/core/src/test/scala/integration/kafka/api/ConsumerWithLegacyMessageFormatIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/ConsumerWithLegacyMessageFormatIntegrationTest.scala index c338865c7d73d..86f18c5bd28ff 100644 --- a/core/src/test/scala/integration/kafka/api/ConsumerWithLegacyMessageFormatIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/api/ConsumerWithLegacyMessageFormatIntegrationTest.scala @@ -17,7 +17,6 @@ package kafka.api import kafka.server.KafkaConfig -import kafka.utils.TestInfoUtils import org.apache.kafka.clients.producer.ProducerConfig import org.apache.kafka.common.TopicPartition import org.apache.kafka.common.config.TopicConfig @@ -40,7 +39,7 @@ class ConsumerWithLegacyMessageFormatIntegrationTest extends AbstractConsumerTes } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetsForTimes(quorum: String): Unit = { val numParts = 2 @@ -117,7 +116,7 @@ class ConsumerWithLegacyMessageFormatIntegrationTest extends AbstractConsumerTes } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testEarliestOrLatestOffsets(quorum: String): Unit = { val topic0 = "topicWithNewMessageFormat" diff --git a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala index bce743545b925..a36f54abdc682 100644 --- a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala +++ b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationTest.scala @@ -113,7 +113,7 @@ class DelegationTokenEndToEndAuthorizationTest extends EndToEndAuthorizationTest superuserClientConfig.put(SaslConfigs.SASL_JAAS_CONFIG, privilegedClientLoginContext) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testCreateUserWithDelegationToken(quorum: String): Unit = { val privilegedAdminClient = Admin.create(privilegedAdminClientConfig) diff --git a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala index f6fbd919ccdaf..64ccb9bd06814 100644 --- a/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala +++ b/core/src/test/scala/integration/kafka/api/DelegationTokenEndToEndAuthorizationWithOwnerTest.scala @@ -93,7 +93,7 @@ class DelegationTokenEndToEndAuthorizationWithOwnerTest extends DelegationTokenE createScramAdminClient(kafkaClientSaslMechanism, tokenRequesterPrincipal.getName, tokenRequesterPassword) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testCreateTokenForOtherUserFails(quorum: String): Unit = { val thrown = assertThrows(classOf[ExecutionException], () => { @@ -102,7 +102,7 @@ class DelegationTokenEndToEndAuthorizationWithOwnerTest extends DelegationTokenE assertTrue(thrown.getMessage.contains("Delegation Token authorization failed")) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDescribeTokenForOtherUserFails(quorum: String): Unit = { TestUtils.resource(createScramAdminClient(kafkaClientSaslMechanism, describeTokenFailPrincipal.getName, describeTokenFailPassword)) { describeTokenFailAdminClient => @@ -116,7 +116,7 @@ class DelegationTokenEndToEndAuthorizationWithOwnerTest extends DelegationTokenE } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDescribeTokenForOtherUserPasses(quorum: String): Unit = { val adminClient = createTokenRequesterAdminClient() diff --git a/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala b/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala index 023b5c38825b1..8bb95436b676e 100644 --- a/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala +++ b/core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala @@ -184,7 +184,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas /** * Tests the ability of producing and consuming with the appropriate ACLs set. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testProduceConsumeViaAssign(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -217,7 +217,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas ._2.asInstanceOf[Gauge[Double]] } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testProduceConsumeViaSubscribe(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -231,7 +231,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testProduceConsumeWithWildcardAcls(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -247,7 +247,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testProduceConsumeWithPrefixedAcls(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -263,7 +263,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testProduceConsumeTopicAutoCreateTopicCreateAcl(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -448,7 +448,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas * Tests that a consumer fails to consume messages without the appropriate * ACL set. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testNoConsumeWithoutDescribeAclViaAssign(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -463,7 +463,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testNoConsumeWithoutDescribeAclViaSubscribe(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -508,7 +508,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testNoConsumeWithDescribeAclViaAssign(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -524,7 +524,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testNoConsumeWithDescribeAclViaSubscribe(quorum: String): Unit = { if (quorum == unimplementedquorum) { @@ -557,7 +557,7 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas * Tests that a consumer fails to consume messages without the appropriate * ACL set. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testNoGroupAcl(quorum: String): Unit = { if (quorum == unimplementedquorum) { diff --git a/core/src/test/scala/integration/kafka/api/GroupAuthorizerIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/GroupAuthorizerIntegrationTest.scala index fd9a5c01ab29a..87767daecb47b 100644 --- a/core/src/test/scala/integration/kafka/api/GroupAuthorizerIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/api/GroupAuthorizerIntegrationTest.scala @@ -17,7 +17,7 @@ import java.util.concurrent.ExecutionException import kafka.api.GroupAuthorizerIntegrationTest._ import kafka.security.authorizer.AclAuthorizer import kafka.server.{BaseRequestTest, KafkaConfig} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.consumer.ConsumerConfig import org.apache.kafka.clients.producer.ProducerRecord import org.apache.kafka.common.TopicPartition @@ -113,7 +113,7 @@ class GroupAuthorizerIntegrationTest extends BaseRequestTest { new AccessControlEntry(principal.toString, WILDCARD_HOST, aclOperation, aclPermissionType) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnauthorizedProduceAndConsume(quorum: String): Unit = { val topic = "topic" @@ -134,7 +134,7 @@ class GroupAuthorizerIntegrationTest extends BaseRequestTest { assertEquals(Set(topic), consumeException.unauthorizedTopics.asScala) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAuthorizedProduceAndConsume(quorum: String): Unit = { val topic = "topic" diff --git a/core/src/test/scala/integration/kafka/api/GroupCoordinatorIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/GroupCoordinatorIntegrationTest.scala index 4bed0b404019c..fc28d69d72987 100644 --- a/core/src/test/scala/integration/kafka/api/GroupCoordinatorIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/api/GroupCoordinatorIntegrationTest.scala @@ -15,7 +15,7 @@ package kafka.api import kafka.integration.KafkaServerTestHarness import kafka.log.UnifiedLog import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.consumer.OffsetAndMetadata import org.apache.kafka.common.TopicPartition import org.junit.jupiter.api.Assertions._ @@ -38,7 +38,7 @@ class GroupCoordinatorIntegrationTest extends KafkaServerTestHarness { KafkaConfig.fromProps(_, overridingProps) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testGroupCoordinatorPropagatesOffsetsTopicCompressionCodec(quorum: String): Unit = { val consumer = TestUtils.createConsumer(bootstrapServers()) diff --git a/core/src/test/scala/integration/kafka/api/LogAppendTimeTest.scala b/core/src/test/scala/integration/kafka/api/LogAppendTimeTest.scala index ff63cb73b1b6e..eeb1f0c22d220 100644 --- a/core/src/test/scala/integration/kafka/api/LogAppendTimeTest.scala +++ b/core/src/test/scala/integration/kafka/api/LogAppendTimeTest.scala @@ -19,7 +19,7 @@ package kafka.api import java.util.Collections import java.util.concurrent.TimeUnit import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.producer.ProducerRecord import org.apache.kafka.common.record.TimestampType import org.junit.jupiter.api.{BeforeEach, TestInfo} @@ -48,7 +48,7 @@ class LogAppendTimeTest extends IntegrationTestHarness { createTopic(topic) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceConsume(quorum: String): Unit = { val producer = createProducer() diff --git a/core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala b/core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala index d997956ac0de1..156c8701c8f84 100644 --- a/core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala @@ -29,7 +29,7 @@ import kafka.integration.KafkaServerTestHarness import kafka.server.metadata.KRaftMetadataCache import kafka.server.{DynamicConfig, KafkaConfig} import kafka.utils.TestUtils._ -import kafka.utils.{Log4jController, TestInfoUtils, TestUtils} +import kafka.utils.{Log4jController, TestUtils} import org.apache.kafka.clients.HostResolver import org.apache.kafka.clients.admin.ConfigEntry.ConfigSource import org.apache.kafka.clients.admin._ @@ -89,7 +89,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClose(quorum: String): Unit = { val client = Admin.create(createConfig) @@ -97,7 +97,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { client.close() // double close has no effect } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testListNodes(quorum: String): Unit = { client = Admin.create(createConfig) @@ -110,7 +110,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(brokerStrs.mkString(","), nodeStrs.mkString(",")) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAdminClientHandlingBadIPWithoutTimeout(quorum: String): Unit = { val config = createConfig @@ -125,7 +125,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { client.describeCluster().nodes().get() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateExistingTopicsThrowTopicExistsException(quorum: String): Unit = { client = Admin.create(createConfig) @@ -142,7 +142,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertTrue(e.getCause.isInstanceOf[TopicExistsException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteTopicsWithIds(quorum: String): Unit = { client = Admin.create(createConfig) @@ -164,7 +164,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { /** * describe should not auto create topics */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeNonExistingTopic(quorum: String): Unit = { client = Admin.create(createConfig) @@ -182,7 +182,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeTopicsWithIds(quorum: String): Unit = { client = Admin.create(createConfig) @@ -201,7 +201,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertFutureExceptionTypeEquals(results.get(nonExistingTopicId), classOf[UnknownTopicIdException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeCluster(quorum: String): Unit = { client = Admin.create(createConfig) @@ -228,7 +228,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeLogDirs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -260,7 +260,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeReplicaLogDirs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -279,7 +279,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAlterReplicaLogDirs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -369,7 +369,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeAndAlterConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -452,7 +452,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { checkValidAlterConfigs(client, this, topicResource1, topicResource2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreatePartitions(quorum: String): Unit = { client = Admin.create(createConfig) @@ -723,7 +723,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSeekAfterDeleteRecords(quorum: String): Unit = { createTopic(topic, numPartitions = 2, replicationFactor = brokerCount) @@ -753,7 +753,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(10L, consumer.position(topicPartition)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testLogStartOffsetCheckpoint(quorum: String): Unit = { createTopic(topic, numPartitions = 2, replicationFactor = brokerCount) @@ -793,7 +793,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { }, s"Expected low watermark of the partition to be 5 but got ${lowWatermark.getOrElse("no response within the timeout")}") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testLogStartOffsetAfterDeleteRecords(quorum: String): Unit = { createTopic(topic, numPartitions = 2, replicationFactor = brokerCount) @@ -814,7 +814,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(3, brokers(i).replicaManager.localLog(topicPartition).get.logStartOffset) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testReplicaCanFetchFromLogStartOffsetAfterDeleteRecords(quorum: String): Unit = { val leaders = createTopic(topic, replicationFactor = brokerCount) @@ -863,7 +863,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { waitForFollowerLog(expectedStartOffset=117L, expectedEndOffset=200L) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAlterLogDirsAfterDeleteRecords(quorum: String): Unit = { client = Admin.create(createConfig) @@ -896,7 +896,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(expectedLEO, brokers.head.replicaManager.localLog(topicPartition).get.logEndOffset) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetsForTimesAfterDeleteRecords(quorum: String): Unit = { createTopic(topic, numPartitions = 2, replicationFactor = brokerCount) @@ -919,7 +919,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertNull(consumer.offsetsForTimes(Map(topicPartition -> JLong.valueOf(0L)).asJava).get(topicPartition)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumeAfterDeleteRecords(quorum: String): Unit = { val consumer = createConsumer() @@ -943,7 +943,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { TestUtils.consumeRecords(consumer, 2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteRecordsWithException(quorum: String): Unit = { val consumer = createConsumer() @@ -963,7 +963,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(classOf[OffsetOutOfRangeException], cause.getClass) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeConfigsForTopic(quorum: String): Unit = { createTopic(topic, numPartitions = 2, replicationFactor = brokerCount) @@ -1000,7 +1000,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { futures.foreach(_.get) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidAlterConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -1012,7 +1012,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { * Also see [[kafka.api.SaslSslAdminIntegrationTest.testAclOperations()]] for tests of ACL operations * when the authorizer is enabled. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAclOperations(quorum: String): Unit = { val acl = new AclBinding(new ResourcePattern(ResourceType.TOPIC, "mytopic3", PatternType.LITERAL), @@ -1029,7 +1029,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { * Test closing the AdminClient with a generous timeout. Calls in progress should be completed, * since they can be done within the timeout. New calls should receive exceptions. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDelayedClose(quorum: String): Unit = { client = Admin.create(createConfig) @@ -1047,7 +1047,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { * Test closing the AdminClient with a timeout of 0, when there are calls with extremely long * timeouts in progress. The calls should be aborted after the hard shutdown timeout elapses. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testForceClose(quorum: String): Unit = { val config = createConfig @@ -1065,7 +1065,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { * Check that a call with a timeout does not complete before the minimum timeout has elapsed, * even when the default request timeout is shorter. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMinimumRequestTimeouts(quorum: String): Unit = { val config = createConfig @@ -1083,7 +1083,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { /** * Test injecting timeouts for calls that are in flight. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCallInFlightTimeouts(quorum: String): Unit = { val config = createConfig @@ -1103,7 +1103,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { /** * Test the consumer group APIs. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumerGroups(quorum: String): Unit = { val config = createConfig @@ -1323,7 +1323,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteConsumerGroupOffsets(quorum: String): Unit = { val config = createConfig @@ -1396,7 +1396,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectPreferredLeaders(quorum: String): Unit = { client = Admin.create(createConfig) @@ -1555,7 +1555,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { TestUtils.assertLeader(client, partition2, 2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectUncleanLeadersForOnePartition(quorum: String): Unit = { // Case: unclean leader election with one topic partition @@ -1583,7 +1583,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { TestUtils.assertLeader(client, partition1, broker2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectUncleanLeadersForManyPartitions(quorum: String): Unit = { // Case: unclean leader election with many topic partitions @@ -1623,7 +1623,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { TestUtils.assertLeader(client, partition2, broker2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectUncleanLeadersForAllPartitions(quorum: String): Unit = { // Case: noop unclean leader election and valid unclean leader election for all partitions @@ -1663,7 +1663,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { TestUtils.assertLeader(client, partition2, broker3) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectUncleanLeadersForUnknownPartitions(quorum: String): Unit = { // Case: unclean leader election for unknown topic @@ -1689,7 +1689,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertTrue(electResult.partitions.get.get(unknownTopic).get.isInstanceOf[UnknownTopicOrPartitionException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectUncleanLeadersWhenNoLiveBrokers(quorum: String): Unit = { // Case: unclean leader election with no live brokers @@ -1718,7 +1718,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertTrue(electResult.partitions.get.get(partition1).get.isInstanceOf[EligibleLeadersNotAvailableException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectUncleanLeadersNoop(quorum: String): Unit = { // Case: noop unclean leader election with explicit topic partitions @@ -1746,7 +1746,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertTrue(electResult.partitions.get.get(partition1).get.isInstanceOf[ElectionNotNeededException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testElectUncleanLeadersAndNoop(quorum: String): Unit = { // Case: one noop unclean leader election and one valid unclean leader election @@ -1786,7 +1786,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { TestUtils.assertLeader(client, partition2, broker3) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testListReassignmentsDoesNotShowNonReassigningPartitions(quorum: String): Unit = { client = Admin.create(createConfig) @@ -1803,7 +1803,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(0, allReassignmentsMap.size()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testListReassignmentsDoesNotShowDeletedPartitions(quorum: String): Unit = { client = Admin.create(createConfig) @@ -1818,7 +1818,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(0, allReassignmentsMap.size()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testValidIncrementalAlterConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -1938,7 +1938,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAppendAlreadyExistsConfigsAndSubtractNotExistsConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -1979,7 +1979,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(appendValues, configs.get(topicResource).get(LogConfig.LEADER_REPLICATION_THROTTLED_REPLICAS_CONFIG).value) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIncrementalAlterConfigsDeleteAndSetBrokerConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -2013,7 +2013,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { }, "Expected to see the broker properties we just modified", pause=25) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIncrementalAlterConfigsDeleteBrokerConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -2050,7 +2050,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { }, "Expected to see the broker properties we just removed to be deleted", pause=25) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidIncrementalAlterConfigs(quorum: String): Unit = { client = Admin.create(createConfig) @@ -2146,7 +2146,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { }) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidAlterPartitionReassignments(quorum: String): Unit = { client = Admin.create(createConfig) @@ -2186,7 +2186,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertFutureExceptionTypeEquals(invalidReplicaResult.get(tp3), classOf[InvalidReplicaAssignmentException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testLongTopicNames(quorum: String): Unit = { val client = Admin.create(createConfig) @@ -2206,7 +2206,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } // Verify that createTopics and alterConfigs fail with null values - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testNullConfigs(quorum: String): Unit = { @@ -2254,7 +2254,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { validateLogConfig(compressionType = "producer") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeConfigsForLog4jLogLevels(quorum: String): Unit = { client = Admin.create(createConfig) @@ -2271,7 +2271,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertTrue(logCleanerLogLevelConfig.synonyms().isEmpty) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) @Disabled // To be re-enabled once KAFKA-8779 is resolved def testIncrementalAlterConfigsForLog4jLogLevels(quorum: String): Unit = { @@ -2336,7 +2336,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { * 4. Change ROOT logger to ERROR * 5. Ensure the kafka.controller.KafkaController logger's level is ERROR (the current root logger level) */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) @Disabled // To be re-enabled once KAFKA-8779 is resolved def testIncrementalAlterConfigsForLog4jLogLevelsCanResetLoggerToCurrentRoot(quorum: String): Unit = { @@ -2379,7 +2379,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertEquals(newRootLogLevel, newRootLoggerConfig.get("kafka.controller.KafkaController").value()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) @Disabled // Zk to be re-enabled once KAFKA-8779 is resolved def testIncrementalAlterConfigsForLog4jLogLevelsCannotResetRootLogger(quorum: String): Unit = { @@ -2391,7 +2391,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { assertTrue(assertThrows(classOf[ExecutionException], () => alterBrokerLoggers(deleteRootLoggerEntry)).getCause.isInstanceOf[InvalidRequestException]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) @Disabled // To be re-enabled once KAFKA-8779 is resolved def testIncrementalAlterConfigsForLog4jLogLevelsDoesNotWorkWithInvalidConfigs(quorum: String): Unit = { @@ -2436,7 +2436,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { * The AlterConfigs API is deprecated and should not support altering log levels */ @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft")) // Zk to be re-enabled once KAFKA-8779 is resolved def testAlterConfigsForLog4jLogLevelsDoesNotWork(quorum: String): Unit = { client = Admin.create(createConfig) @@ -2483,13 +2483,13 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAppendConfigToEmptyDefaultValue(ignored: String): Unit = { testAppendConfig(new Properties(), "0:0", "0:0") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAppendConfigToExistentValue(ignored: String): Unit = { val props = new Properties(); @@ -2521,7 +2521,7 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { * Note: this test requires some custom static broker and controller configurations, which are set up in * BaseAdminIntegrationTest.modifyConfigs. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateTopicsReturnsConfigs(quorum: String): Unit = { client = Admin.create(super.createConfig) diff --git a/core/src/test/scala/integration/kafka/api/PlaintextEndToEndAuthorizationTest.scala b/core/src/test/scala/integration/kafka/api/PlaintextEndToEndAuthorizationTest.scala index 18e792344fc5f..d4987d095ebe1 100644 --- a/core/src/test/scala/integration/kafka/api/PlaintextEndToEndAuthorizationTest.scala +++ b/core/src/test/scala/integration/kafka/api/PlaintextEndToEndAuthorizationTest.scala @@ -26,7 +26,6 @@ import org.junit.jupiter.api.Assertions._ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource import org.apache.kafka.common.errors.TopicAuthorizationException -import kafka.utils.TestInfoUtils // This test case uses a separate listener for client and inter-broker communication, from // which we derive corresponding principals @@ -89,7 +88,7 @@ class PlaintextEndToEndAuthorizationTest extends EndToEndAuthorizationTest { superuserClientConfig.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers(interBrokerListenerName)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testListenerName(quorum: String): Unit = { // To check the client listener name, establish a session on the server by sending any request eg sendRecords diff --git a/core/src/test/scala/integration/kafka/api/PlaintextProducerSendTest.scala b/core/src/test/scala/integration/kafka/api/PlaintextProducerSendTest.scala index 77132d919bc2e..133481be6f9cb 100644 --- a/core/src/test/scala/integration/kafka/api/PlaintextProducerSendTest.scala +++ b/core/src/test/scala/integration/kafka/api/PlaintextProducerSendTest.scala @@ -19,7 +19,7 @@ package kafka.api import java.util.Properties import java.util.concurrent.{ExecutionException, Future, TimeUnit} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.producer.{BufferExhaustedException, KafkaProducer, ProducerConfig, ProducerRecord, RecordMetadata} import org.apache.kafka.common.config.TopicConfig import org.apache.kafka.common.errors.{InvalidTimestampException, RecordTooLargeException, SerializationException, TimeoutException} @@ -37,7 +37,7 @@ import scala.annotation.nowarn class PlaintextProducerSendTest extends BaseProducerSendTest { - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testWrongSerializer(quorum: String): Unit = { val producerProps = new Properties() @@ -49,7 +49,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { assertThrows(classOf[SerializationException], () => producer.send(record)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testBatchSizeZero(quorum: String): Unit = { val producer = createProducer( @@ -60,7 +60,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { } @Timeout(value = 15, unit = TimeUnit.SECONDS, threadMode = Timeout.ThreadMode.SEPARATE_THREAD) - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testBatchSizeZeroNoPartitionNoRecordKey(quorum: String): Unit = { val producer = createProducer(batchSize = 0) @@ -83,7 +83,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendCompressedMessageWithLogAppendTime(quorum: String): Unit = { val producer = createProducer( @@ -93,7 +93,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { sendAndVerifyTimestamp(producer, TimestampType.LOG_APPEND_TIME) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendNonCompressedMessageWithLogAppendTime(quorum: String): Unit = { val producer = createProducer(lingerMs = Int.MaxValue, deliveryTimeoutMs = Int.MaxValue) @@ -105,7 +105,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { * * The topic should be created upon sending the first message */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAutoCreateTopic(quorum: String): Unit = { val producer = createProducer() @@ -121,7 +121,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @MethodSource(Array("quorumAndTimestampConfigProvider")) def testSendWithInvalidBeforeAndAfterTimestamp(quorum: String, messageTimeStampConfig: String, recordTimestamp: Long): Unit = { val topicProps = new Properties() @@ -194,7 +194,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { // Test that producer with max.block.ms=0 can be used to send in non-blocking mode // where requests are failed immediately without blocking if metadata is not available // or buffer is full. - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testNonBlockingProducer(quorum: String): Unit = { @@ -250,7 +250,7 @@ class PlaintextProducerSendTest extends BaseProducerSendTest { verifySendSuccess(future2) // previous batch should be completed and sent now } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendRecordBatchWithMaxRequestSizeAndHigher(quorum: String): Unit = { val producerProps = new Properties() diff --git a/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala b/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala index 4fe7f5e87f93a..480533fe08d5e 100644 --- a/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala +++ b/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala @@ -21,7 +21,7 @@ import java.util.concurrent.ExecutionException import java.util.Properties import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.producer._ import org.apache.kafka.common.config.TopicConfig import org.apache.kafka.common.errors._ @@ -85,7 +85,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { /** * With ack == 0 the future metadata will have no exceptions with offset -1 */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTooLargeRecordWithAckZero(quorum: String): Unit = { // create topic @@ -103,7 +103,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { /** * With ack == 1 the future metadata will throw ExecutionException caused by RecordTooLargeException */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTooLargeRecordWithAckOne(quorum: String): Unit = { // create topic @@ -133,14 +133,14 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { } /** This should succeed as the replica fetcher thread can handle oversized messages since KIP-74 */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPartitionTooLargeForReplicationWithAckAll(quorum: String): Unit = { checkTooLargeRecordForReplicationWithAckAll(replicaFetchMaxPartitionBytes) } /** This should succeed as the replica fetcher thread can handle oversized messages since KIP-74 */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testResponseTooLargeForReplicationWithAckAll(quorum: String): Unit = { checkTooLargeRecordForReplicationWithAckAll(replicaFetchMaxResponseBytes) @@ -149,7 +149,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { /** * With non-exist-topic the future metadata should return ExecutionException caused by TimeoutException */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testNonExistentTopic(quorum: String): Unit = { // send a record with non-exist topic @@ -167,7 +167,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { * CorruptRecordException * TimeoutException */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testWrongBrokerList(quorum: String): Unit = { // create topic @@ -185,7 +185,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { * Send with invalid partition id should return ExecutionException caused by TimeoutException * when partition is higher than the upper bound of partitions. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidPartition(quorum: String): Unit = { // create topic with a single partition @@ -200,7 +200,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { /** * The send call after producer closed should throw IllegalStateException */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendAfterClosed(quorum: String): Unit = { // create topic @@ -221,7 +221,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { assertThrows(classOf[IllegalStateException], () => producer3.send(record)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCannotSendToInternalTopic(quorum: String): Unit = { @@ -231,7 +231,7 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness { assertTrue(thrown.getCause.isInstanceOf[InvalidTopicException], "Unexpected exception while sending to an invalid topic " + thrown.getCause) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testNotEnoughReplicasAfterBrokerShutdown(quorum: String): Unit = { val topicName = "minisrtest2" diff --git a/core/src/test/scala/integration/kafka/api/ProducerIdExpirationTest.scala b/core/src/test/scala/integration/kafka/api/ProducerIdExpirationTest.scala index 407c396bd8a82..b3cb741432cfb 100644 --- a/core/src/test/scala/integration/kafka/api/ProducerIdExpirationTest.scala +++ b/core/src/test/scala/integration/kafka/api/ProducerIdExpirationTest.scala @@ -22,7 +22,7 @@ import java.util.{Collections, List, Map, Properties} import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import kafka.utils.TestUtils.{consumeRecords, createAdminClient} import org.apache.kafka.clients.admin.{Admin,AlterConfigOp, ConfigEntry, ProducerState} import org.apache.kafka.clients.consumer.Consumer @@ -77,7 +77,7 @@ class ProducerIdExpirationTest extends KafkaServerTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProducerIdExpirationWithNoTransactions(quorum: String): Unit = { producer = TestUtils.createProducer(bootstrapServers(), enableIdempotence = true) @@ -101,7 +101,7 @@ class ProducerIdExpirationTest extends KafkaServerTestHarness { assertEquals(1, producerState.size) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionAfterTransactionIdExpiresButProducerIdRemains(quorum: String): Unit = { producer = TestUtils.createTransactionalProducer("transactionalProducer", brokers) @@ -149,7 +149,7 @@ class ProducerIdExpirationTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDynamicProducerIdExpirationMs(quorum: String): Unit = { producer = TestUtils.createProducer(bootstrapServers(), enableIdempotence = true) diff --git a/core/src/test/scala/integration/kafka/api/ProducerSendWhileDeletionTest.scala b/core/src/test/scala/integration/kafka/api/ProducerSendWhileDeletionTest.scala index 0ad6384b115ea..82026ab7f71c5 100644 --- a/core/src/test/scala/integration/kafka/api/ProducerSendWhileDeletionTest.scala +++ b/core/src/test/scala/integration/kafka/api/ProducerSendWhileDeletionTest.scala @@ -17,7 +17,7 @@ package kafka.api import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.NewPartitionReassignment import org.apache.kafka.clients.producer.{ProducerConfig, ProducerRecord} import org.apache.kafka.common.TopicPartition @@ -49,7 +49,7 @@ class ProducerSendWhileDeletionTest extends IntegrationTestHarness { * Producer will attempt to send messages to the partition specified in each record, and should * succeed as long as the partition is included in the metadata. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSendWithTopicDeletionMidWay(quorum: String): Unit = { val numRecords = 10 diff --git a/core/src/test/scala/integration/kafka/api/SaslEndToEndAuthorizationTest.scala b/core/src/test/scala/integration/kafka/api/SaslEndToEndAuthorizationTest.scala index 2f599c5ae323a..488ac6ed53705 100644 --- a/core/src/test/scala/integration/kafka/api/SaslEndToEndAuthorizationTest.scala +++ b/core/src/test/scala/integration/kafka/api/SaslEndToEndAuthorizationTest.scala @@ -23,9 +23,7 @@ import org.junit.jupiter.api.{BeforeEach, TestInfo, Timeout} import org.junit.jupiter.api.Assertions.{assertEquals, assertTrue, fail} import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource -import kafka.utils.TestInfoUtils -import scala.collection.immutable.List import scala.jdk.CollectionConverters._ abstract class SaslEndToEndAuthorizationTest extends EndToEndAuthorizationTest { @@ -58,7 +56,7 @@ abstract class SaslEndToEndAuthorizationTest extends EndToEndAuthorizationTest { * the second one connects ok, but fails to consume messages due to the ACL. */ @Timeout(15) - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testTwoConsumersWithDifferentSaslCredentials(quorum: String): Unit = { if (quorum == unimplementedquorum) { diff --git a/core/src/test/scala/integration/kafka/api/SaslMultiMechanismConsumerTest.scala b/core/src/test/scala/integration/kafka/api/SaslMultiMechanismConsumerTest.scala index 4cd2145319094..df21372e4653a 100644 --- a/core/src/test/scala/integration/kafka/api/SaslMultiMechanismConsumerTest.scala +++ b/core/src/test/scala/integration/kafka/api/SaslMultiMechanismConsumerTest.scala @@ -13,7 +13,7 @@ package kafka.api import org.junit.jupiter.api.{AfterEach, BeforeEach, TestInfo, Timeout} -import kafka.utils.{JaasTestUtils, TestInfoUtils, TestUtils} +import kafka.utils.{JaasTestUtils, TestUtils} import org.apache.kafka.common.security.auth.SecurityProtocol import org.apache.kafka.server.config.ZkConfigs import org.junit.jupiter.params.ParameterizedTest @@ -44,7 +44,7 @@ class SaslMultiMechanismConsumerTest extends BaseConsumerTest with SaslSetup { closeSasl() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMultipleBrokerMechanisms(quorum: String): Unit = { val plainSaslProducer = createProducer() diff --git a/core/src/test/scala/integration/kafka/api/SaslScramSslEndToEndAuthorizationTest.scala b/core/src/test/scala/integration/kafka/api/SaslScramSslEndToEndAuthorizationTest.scala index 2d1aaf8cc7767..11a8bb3c16339 100644 --- a/core/src/test/scala/integration/kafka/api/SaslScramSslEndToEndAuthorizationTest.scala +++ b/core/src/test/scala/integration/kafka/api/SaslScramSslEndToEndAuthorizationTest.scala @@ -83,7 +83,7 @@ class SaslScramSslEndToEndAuthorizationTest extends SaslEndToEndAuthorizationTes createScramCredentialsViaPrivilegedAdminClient(JaasTestUtils.KafkaScramUser2, JaasTestUtils.KafkaScramPassword2) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAuthentications(quorum: String): Unit = { val successfulAuths = TestUtils.totalMetricValue(brokers.head, "successful-authentication-total") diff --git a/core/src/test/scala/integration/kafka/api/TransactionsBounceTest.scala b/core/src/test/scala/integration/kafka/api/TransactionsBounceTest.scala index f236c93585143..07bc3b624fb37 100644 --- a/core/src/test/scala/integration/kafka/api/TransactionsBounceTest.scala +++ b/core/src/test/scala/integration/kafka/api/TransactionsBounceTest.scala @@ -19,7 +19,7 @@ package kafka.api import java.util.Properties import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.consumer.{Consumer, ConsumerConfig} import org.apache.kafka.clients.producer.{KafkaProducer, ProducerConfig} import org.apache.kafka.clients.producer.internals.ErrorLoggingCallback @@ -74,14 +74,14 @@ class TransactionsBounceTest extends IntegrationTestHarness { override protected def brokerCount: Int = 4 @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testWithGroupId(quorum: String): Unit = { testBrokerFailure((producer, groupId, consumer) => producer.sendOffsetsToTransaction(TestUtils.consumerPositions(consumer).asJava, groupId)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testWithGroupMetadata(quorum: String): Unit = { testBrokerFailure((producer, _, consumer) => diff --git a/core/src/test/scala/integration/kafka/api/TransactionsExpirationTest.scala b/core/src/test/scala/integration/kafka/api/TransactionsExpirationTest.scala index 709efb89285bd..5fc5fb6b09666 100644 --- a/core/src/test/scala/integration/kafka/api/TransactionsExpirationTest.scala +++ b/core/src/test/scala/integration/kafka/api/TransactionsExpirationTest.scala @@ -21,7 +21,7 @@ import java.util.{Collections, Properties} import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import kafka.utils.TestUtils.{consumeRecords, createAdminClient} import org.apache.kafka.clients.admin.{Admin, ProducerState} import org.apache.kafka.clients.consumer.Consumer @@ -78,7 +78,7 @@ class TransactionsExpirationTest extends KafkaServerTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testBumpTransactionalEpochAfterInvalidProducerIdMapping(quorum: String): Unit = { producer.initTransactions() @@ -118,7 +118,7 @@ class TransactionsExpirationTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionAfterProducerIdExpires(quorum: String): Unit = { producer.initTransactions() diff --git a/core/src/test/scala/integration/kafka/api/TransactionsTest.scala b/core/src/test/scala/integration/kafka/api/TransactionsTest.scala index 1c5064d29abbe..20e2e1e748ed7 100644 --- a/core/src/test/scala/integration/kafka/api/TransactionsTest.scala +++ b/core/src/test/scala/integration/kafka/api/TransactionsTest.scala @@ -23,7 +23,7 @@ import java.time.Duration import java.util.concurrent.TimeUnit import java.util.{Optional, Properties} import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import kafka.utils.TestUtils.{consumeRecords, waitUntilTrue} import org.apache.kafka.clients.consumer.{Consumer, ConsumerConfig, ConsumerGroupMetadata, OffsetAndMetadata} import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} @@ -115,7 +115,7 @@ class TransactionsTest extends IntegrationTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testBasicTransactions(quorum: String): Unit = { val producer = transactionalProducers.head @@ -176,7 +176,7 @@ class TransactionsTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testReadCommittedConsumerShouldNotSeeUndecidedData(quorum: String): Unit = { val producer1 = transactionalProducers.head @@ -244,7 +244,7 @@ class TransactionsTest extends IntegrationTestHarness { assertNull(readCommittedOffsetsForTimes.get(tp2)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testDelayedFetchIncludesAbortedTransaction(quorum: String): Unit = { val producer1 = transactionalProducers.head @@ -303,14 +303,14 @@ class TransactionsTest extends IntegrationTestHarness { } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testSendOffsetsWithGroupId(quorum: String): Unit = { sendOffset((producer, groupId, consumer) => producer.sendOffsetsToTransaction(TestUtils.consumerPositions(consumer).asJava, groupId)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testSendOffsetsWithGroupMetadata(quorum: String): Unit = { sendOffset((producer, _, consumer) => @@ -390,7 +390,7 @@ class TransactionsTest extends IntegrationTestHarness { assertEquals(valueSeq.size, valueSet.size, s"Expected ${valueSeq.size} unique messages in $topic2.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testFencingOnCommit(quorum: String): Unit = { val producer1 = transactionalProducers(0) @@ -420,7 +420,7 @@ class TransactionsTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testFencingOnSendOffsets(quorum: String): Unit = { val producer1 = transactionalProducers(0) @@ -452,7 +452,7 @@ class TransactionsTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testOffsetMetadataInSendOffsetsToTransaction(quorum: String): Unit = { val tp = new TopicPartition(topic1, 0) @@ -478,26 +478,26 @@ class TransactionsTest extends IntegrationTestHarness { TestUtils.waitUntilTrue(() => offsetAndMetadata.equals(consumer.committed(Set(tp).asJava).get(tp)), "cannot read committed offset") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testInitTransactionsTimeout(quorum: String): Unit = { testTimeout(false, producer => producer.initTransactions()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testSendOffsetsToTransactionTimeout(quorum: String): Unit = { testTimeout(true, producer => producer.sendOffsetsToTransaction( Map(new TopicPartition(topic1, 0) -> new OffsetAndMetadata(0)).asJava, new ConsumerGroupMetadata("test-group"))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testCommitTransactionTimeout(quorum: String): Unit = { testTimeout(true, producer => producer.commitTransaction()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testAbortTransactionTimeout(quorum: String): Unit = { testTimeout(true, producer => producer.abortTransaction()) @@ -518,7 +518,7 @@ class TransactionsTest extends IntegrationTestHarness { producer.close(Duration.ZERO) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testFencingOnSend(quorum: String): Unit = { val producer1 = transactionalProducers(0) @@ -563,7 +563,7 @@ class TransactionsTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testFencingOnAddPartitions(quorum: String): Unit = { val producer1 = transactionalProducers(0) @@ -610,7 +610,7 @@ class TransactionsTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testFencingOnTransactionExpiration(quorum: String): Unit = { val producer = createTransactionalProducer("expiringProducer", transactionTimeoutMs = 100) @@ -653,7 +653,7 @@ class TransactionsTest extends IntegrationTestHarness { assertTrue(transactionalRecords.isEmpty) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testMultipleMarkersOneLeader(quorum: String): Unit = { val firstProducer = transactionalProducers.head @@ -691,7 +691,7 @@ class TransactionsTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testConsecutivelyRunInitTransactions(quorum: String): Unit = { val producer = createTransactionalProducer(transactionalId = "normalProducer") @@ -700,7 +700,7 @@ class TransactionsTest extends IntegrationTestHarness { assertThrows(classOf[IllegalStateException], () => producer.initTransactions()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testBumpTransactionalEpoch(quorum: String): Unit = { val producer = createTransactionalProducer("transactionalProducer", @@ -762,7 +762,7 @@ class TransactionsTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft", "kraft+kip848")) def testFailureToFenceEpoch(quorum: String): Unit = { val producer1 = transactionalProducers.head diff --git a/core/src/test/scala/integration/kafka/api/TransactionsWithMaxInFlightOneTest.scala b/core/src/test/scala/integration/kafka/api/TransactionsWithMaxInFlightOneTest.scala index 72952eb5677be..90d5b2b5c40bd 100644 --- a/core/src/test/scala/integration/kafka/api/TransactionsWithMaxInFlightOneTest.scala +++ b/core/src/test/scala/integration/kafka/api/TransactionsWithMaxInFlightOneTest.scala @@ -20,7 +20,7 @@ package kafka.api import java.util.Properties import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import kafka.utils.TestUtils.consumeRecords import org.apache.kafka.clients.consumer.Consumer import org.apache.kafka.clients.producer.KafkaProducer @@ -70,7 +70,7 @@ class TransactionsWithMaxInFlightOneTest extends KafkaServerTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionalProducerSingleBrokerMaxInFlightOne(quorum: String): Unit = { // We want to test with one broker to verify multiple requests queued on a connection diff --git a/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala b/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala index d11dff9daec01..ee284945fa664 100644 --- a/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala +++ b/core/src/test/scala/integration/kafka/network/DynamicConnectionQuotaTest.scala @@ -23,7 +23,7 @@ import java.net.{InetAddress, Socket} import java.util.concurrent._ import java.util.{Collections, Properties} import kafka.server.{BaseRequestTest, KafkaConfig} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.Admin import org.apache.kafka.common.config.internals.QuotaConfigs import org.apache.kafka.common.message.ProduceRequestData @@ -78,7 +78,7 @@ class DynamicConnectionQuotaTest extends BaseRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDynamicConnectionQuota(quorum: String): Unit = { val maxConnectionsPerIP = 5 @@ -106,7 +106,7 @@ class DynamicConnectionQuotaTest extends BaseRequestTest { verifyMaxConnections(maxConnectionsPerIPOverride, connectAndVerify) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDynamicListenerConnectionQuota(quorum: String): Unit = { val initialConnectionCount = connectionCount @@ -179,7 +179,7 @@ class DynamicConnectionQuotaTest extends BaseRequestTest { } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDynamicListenerConnectionCreationRateQuota(quorum: String): Unit = { // Create another listener. PLAINTEXT is an inter-broker listener @@ -241,7 +241,7 @@ class DynamicConnectionQuotaTest extends BaseRequestTest { waitForConnectionCount(initialConnectionCount) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDynamicIpConnectionRateQuota(quorum: String): Unit = { val connRateLimit = 10 diff --git a/core/src/test/scala/integration/kafka/network/DynamicNumNetworkThreadsTest.scala b/core/src/test/scala/integration/kafka/network/DynamicNumNetworkThreadsTest.scala index 177a89c8c670f..6945905a7c059 100644 --- a/core/src/test/scala/integration/kafka/network/DynamicNumNetworkThreadsTest.scala +++ b/core/src/test/scala/integration/kafka/network/DynamicNumNetworkThreadsTest.scala @@ -18,7 +18,7 @@ package kafka.network import kafka.server.{BaseRequestTest, KafkaConfig} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.{Admin, AdminClientConfig} import org.apache.kafka.common.network.ListenerName import org.apache.kafka.common.security.auth.SecurityProtocol @@ -66,7 +66,7 @@ class DynamicNumNetworkThreadsTest extends BaseRequestTest { .count(listener == _.tags().get("listener")) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDynamicNumNetworkThreads(quorum: String): Unit = { // Increase the base network thread count diff --git a/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala b/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala index 9eeb79c74e29c..898fb4241eebb 100644 --- a/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala +++ b/core/src/test/scala/integration/kafka/server/DynamicBrokerReconfigurationTest.scala @@ -181,7 +181,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup closeSasl() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConfigDescribeUsingAdminClient(quorum: String): Unit = { @@ -281,7 +281,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup assertEquals(List((CleanerConfig.LOG_CLEANER_THREADS_PROP, ConfigSource.DEFAULT_CONFIG)), synonymsList(logCleanerThreads)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUpdatesUsingConfigProvider(quorum: String): Unit = { val PollingIntervalVal = f"$${file:polling.interval:interval}" @@ -354,7 +354,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testKeyStoreAlter(quorum: String): Unit = { val topic2 = "testtopic2" @@ -423,7 +423,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup stopAndVerifyProduceConsume(producerThread, consumerThread) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTrustStoreAlter(quorum: String): Unit = { val producerBuilder = ProducerBuilder().listenerName(SecureInternal).securityProtocol(SecurityProtocol.SSL) @@ -528,7 +528,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testLogCleanerConfig(quorum: String): Unit = { val (producerThread, consumerThread) = startProduceConsume(retries = 0) @@ -574,7 +574,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup stopAndVerifyProduceConsume(producerThread, consumerThread) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsecutiveConfigChange(quorum: String): Unit = { val topic2 = "testtopic2" @@ -1176,7 +1176,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup assertTrue(partitions.exists(_.leader == null), "Did not find partitions with no leader") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testReconfigureRemovedListener(quorum: String): Unit = { val client = adminClients.head @@ -1256,7 +1256,7 @@ class DynamicBrokerReconfigurationTest extends QuorumTestHarness with SaslSetup } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTransactionVerificationEnable(quorum: String): Unit = { def verifyConfiguration(enabled: Boolean): Unit = { diff --git a/core/src/test/scala/integration/kafka/server/FetchFromFollowerIntegrationTest.scala b/core/src/test/scala/integration/kafka/server/FetchFromFollowerIntegrationTest.scala index 89b82fea31e36..14c385e2d1e13 100644 --- a/core/src/test/scala/integration/kafka/server/FetchFromFollowerIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/server/FetchFromFollowerIntegrationTest.scala @@ -16,7 +16,7 @@ */ package kafka.server -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.NewPartitionReassignment import org.apache.kafka.clients.consumer.{ConsumerConfig, KafkaConsumer, RangeAssignor} import org.apache.kafka.clients.producer.ProducerRecord @@ -54,7 +54,7 @@ class FetchFromFollowerIntegrationTest extends BaseFetchRequestTest { .map(KafkaConfig.fromProps(_, overridingProps)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) @Timeout(15) def testFollowerCompleteDelayedFetchesOnReplication(quorum: String): Unit = { @@ -99,7 +99,7 @@ class FetchFromFollowerIntegrationTest extends BaseFetchRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testFetchFromLeaderWhilePreferredReadReplicaIsUnavailable(quorum: String): Unit = { // Create a topic with 2 replicas where broker 0 is the leader and 1 is the follower. @@ -127,7 +127,7 @@ class FetchFromFollowerIntegrationTest extends BaseFetchRequestTest { assertEquals(-1, getPreferredReplica) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testFetchFromFollowerWithRoll(quorum: String): Unit = { // Create a topic with 2 replicas where broker 0 is the leader and 1 is the follower. @@ -179,7 +179,7 @@ class FetchFromFollowerIntegrationTest extends BaseFetchRequestTest { } @Disabled - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testRackAwareRangeAssignor(quorum: String): Unit = { val partitionList = brokers.indices.toList diff --git a/core/src/test/scala/integration/kafka/tools/MirrorMakerIntegrationTest.scala b/core/src/test/scala/integration/kafka/tools/MirrorMakerIntegrationTest.scala index 73e1a3bb14523..772394e56dd77 100644 --- a/core/src/test/scala/integration/kafka/tools/MirrorMakerIntegrationTest.scala +++ b/core/src/test/scala/integration/kafka/tools/MirrorMakerIntegrationTest.scala @@ -22,7 +22,7 @@ import scala.collection.Seq import kafka.integration.KafkaServerTestHarness import kafka.server.KafkaConfig import kafka.tools.MirrorMaker.{ConsumerWrapper, MirrorMakerProducer, NoRecordsException} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.consumer.{ConsumerConfig, KafkaConsumer} import org.apache.kafka.clients.producer.{ProducerConfig, ProducerRecord} import org.apache.kafka.common.TopicPartition @@ -58,7 +58,7 @@ class MirrorMakerIntegrationTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitOffsetsThrowTimeoutException(quorum: String): Unit = { val consumerProps = new Properties @@ -73,7 +73,7 @@ class MirrorMakerIntegrationTest extends KafkaServerTestHarness { mirrorMakerConsumer.close() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommitOffsetsRemoveNonExistentTopics(quorum: String): Unit = { val consumerProps = new Properties @@ -90,7 +90,7 @@ class MirrorMakerIntegrationTest extends KafkaServerTestHarness { mirrorMakerConsumer.close() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCommaSeparatedRegex(quorum: String): Unit = { val topic = "new-topic" diff --git a/core/src/test/scala/kafka/utils/TestInfoUtils.scala b/core/src/test/scala/kafka/utils/TestInfoUtils.scala index 8e69bbf0efb0c..0e9e197c42701 100644 --- a/core/src/test/scala/kafka/utils/TestInfoUtils.scala +++ b/core/src/test/scala/kafka/utils/TestInfoUtils.scala @@ -52,7 +52,6 @@ object TestInfoUtils { testInfo.getDisplayName().contains("quorum=zkMigration") } } - final val TestWithParameterizedQuorumName = "{displayName}.{argumentsWithNames}" final val TestWithParameterizedQuorumAndGroupProtocolNames = "{displayName}.quorum={0}.groupProtocol={1}" diff --git a/core/src/test/scala/unit/kafka/admin/AddPartitionsTest.scala b/core/src/test/scala/unit/kafka/admin/AddPartitionsTest.scala index ea57207e278c3..63c611f8ee713 100755 --- a/core/src/test/scala/unit/kafka/admin/AddPartitionsTest.scala +++ b/core/src/test/scala/unit/kafka/admin/AddPartitionsTest.scala @@ -20,7 +20,7 @@ package kafka.admin import java.util.{Collections, Optional} import kafka.controller.ReplicaAssignment import kafka.server.{BaseRequestTest, BrokerServer} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import kafka.utils.TestUtils._ import org.apache.kafka.clients.admin.{Admin, NewPartitions, NewTopic} import org.apache.kafka.common.errors.InvalidReplicaAssignmentException @@ -70,7 +70,7 @@ class AddPartitionsTest extends BaseRequestTest { admin = createAdminClient() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testWrongReplicaCount(quorum: String): Unit = { assertEquals(classOf[InvalidReplicaAssignmentException], assertThrows(classOf[ExecutionException], () => { @@ -83,7 +83,7 @@ class AddPartitionsTest extends BaseRequestTest { * Test that when we supply a manual partition assignment to createTopics, it must be 0-based * and consecutive. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMissingPartitionsInCreateTopics(quorum: String): Unit = { val topic6Placements = new util.HashMap[Integer, util.List[Integer]] @@ -109,7 +109,7 @@ class AddPartitionsTest extends BaseRequestTest { * Test that when we supply a manual partition assignment to createPartitions, it must contain * enough partitions. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMissingPartitionsInCreatePartitions(quorum: String): Unit = { val cause = assertThrows(classOf[ExecutionException], () => @@ -133,7 +133,7 @@ class AddPartitionsTest extends BaseRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIncrementPartitions(quorum: String): Unit = { admin.createPartitions(Collections.singletonMap(topic1, NewPartitions.increaseTo(3))).all().get() @@ -162,7 +162,7 @@ class AddPartitionsTest extends BaseRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testManualAssignmentOfReplicas(quorum: String): Unit = { // Add 2 partitions @@ -191,7 +191,7 @@ class AddPartitionsTest extends BaseRequestTest { assertEquals(Set(0, 1), replicas.asScala.toSet) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) // TODO: add kraft support def testReplicaPlacementAllServers(quorum: String): Unit = { admin.createPartitions(Collections.singletonMap(topic3, NewPartitions.increaseTo(7))).all().get() @@ -217,7 +217,7 @@ class AddPartitionsTest extends BaseRequestTest { validateLeaderAndReplicas(topicMetadata, 6, 0, Set(0, 1, 2, 3)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) // TODO: add kraft support def testReplicaPlacementPartialServers(quorum: String): Unit = { admin.createPartitions(Collections.singletonMap(topic2, NewPartitions.increaseTo(3))).all().get() diff --git a/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala b/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala index 894a47d5608bc..b77173d446c5b 100644 --- a/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala +++ b/core/src/test/scala/unit/kafka/admin/DeleteTopicTest.scala @@ -58,7 +58,7 @@ class DeleteTopicTest extends QuorumTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteTopicWithAllAliveReplicas(quorum: String): Unit = { brokers = createTestTopicAndCluster(topic) @@ -67,7 +67,7 @@ class DeleteTopicTest extends QuorumTestHarness { TestUtils.verifyTopicDeletion(zkClientOrNull, topic, 1, brokers) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testResumeDeleteTopicWithRecoveredFollower(quorum: String): Unit = { val topicPartition = new TopicPartition("test", 0) @@ -122,7 +122,7 @@ class DeleteTopicTest extends QuorumTestHarness { TestUtils.verifyTopicDeletion(zkClient, topic, 1, brokers) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPartitionReassignmentDuringDeleteTopic(quorum: String): Unit = { val topicPartition = new TopicPartition(topic, 0) @@ -194,7 +194,7 @@ class DeleteTopicTest extends QuorumTestHarness { }.toSet } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIncreasePartitionCountDuringDeleteTopic(quorum: String): Unit = { val topicPartition = new TopicPartition(topic, 0) @@ -280,7 +280,7 @@ class DeleteTopicTest extends QuorumTestHarness { TestUtils.verifyTopicDeletion(zkClientOrNull, topic, 2, partitionHostingBrokers) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteTopicDuringAddPartition(quorum: String): Unit = { brokers = createTestTopicAndCluster(topic) @@ -320,7 +320,7 @@ class DeleteTopicTest extends QuorumTestHarness { "Replica logs not for new partition [test,1] not deleted after delete topic is complete.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAddPartitionDuringDeleteTopic(quorum: String): Unit = { brokers = createTestTopicAndCluster(topic) @@ -346,7 +346,7 @@ class DeleteTopicTest extends QuorumTestHarness { assertTrue(brokers.forall(_.logManager.getLog(newPartition).isEmpty), "Replica logs not deleted after delete topic is complete") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testRecreateTopicAfterDeletion(quorum: String): Unit = { val expectedReplicaAssignment = Map(0 -> List(0, 1, 2)) @@ -362,7 +362,7 @@ class DeleteTopicTest extends QuorumTestHarness { "Replicas for topic test not created.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteNonExistingTopic(quorum: String): Unit = { val topicPartition = new TopicPartition("test", 0) @@ -393,7 +393,7 @@ class DeleteTopicTest extends QuorumTestHarness { TestUtils.waitUntilLeaderIsElectedOrChangedWithAdmin(admin, topic, 0, 1000) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteTopicWithCleaner(quorum: String): Unit = { val topicName = "test" @@ -479,7 +479,7 @@ class DeleteTopicTest extends QuorumTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDisableDeleteTopic(quorum: String): Unit = { val topicPartition = new TopicPartition(topic, 0) diff --git a/core/src/test/scala/unit/kafka/admin/UserScramCredentialsCommandTest.scala b/core/src/test/scala/unit/kafka/admin/UserScramCredentialsCommandTest.scala index 9e3caa8557180..7dd2143ed305f 100644 --- a/core/src/test/scala/unit/kafka/admin/UserScramCredentialsCommandTest.scala +++ b/core/src/test/scala/unit/kafka/admin/UserScramCredentialsCommandTest.scala @@ -22,7 +22,6 @@ import java.nio.charset.StandardCharsets import kafka.server.BaseRequestTest import kafka.utils.Exit import kafka.utils.TestUtils -import kafka.utils.TestInfoUtils import org.junit.jupiter.api.Assertions._ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource @@ -60,7 +59,7 @@ class UserScramCredentialsCommandTest extends BaseRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testUserScramCredentialsRequests(quorum: String): Unit = { val user1 = "user1" @@ -123,7 +122,7 @@ class UserScramCredentialsCommandTest extends BaseRequestTest { s"Failed to describe All users deleted") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterWithEmptyPassword(quorum: String): Unit = { val user1 = "user1" @@ -132,7 +131,7 @@ class UserScramCredentialsCommandTest extends BaseRequestTest { assertEquals(1, result.exitStatus.get, "Expected empty password to cause failure with exit status=1") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDescribeUnknownUser(quorum: String): Unit = { val unknownUser = "unknownUser" diff --git a/core/src/test/scala/unit/kafka/integration/MetricsDuringTopicCreationDeletionTest.scala b/core/src/test/scala/unit/kafka/integration/MetricsDuringTopicCreationDeletionTest.scala index 3f0abf68a9042..880bed10dc679 100644 --- a/core/src/test/scala/unit/kafka/integration/MetricsDuringTopicCreationDeletionTest.scala +++ b/core/src/test/scala/unit/kafka/integration/MetricsDuringTopicCreationDeletionTest.scala @@ -19,7 +19,7 @@ package kafka.integration import java.util.Properties import kafka.server.KafkaConfig -import kafka.utils.{Logging, TestInfoUtils, TestUtils} +import kafka.utils.{Logging, TestUtils} import scala.jdk.CollectionConverters._ import org.junit.jupiter.api.{BeforeEach, TestInfo} @@ -68,7 +68,7 @@ class MetricsDuringTopicCreationDeletionTest extends KafkaServerTestHarness with /* * checking all metrics we care in a single test is faster though it would be more elegant to have 3 @Test methods */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMetricsDuringTopicCreateDelete(quorum: String): Unit = { diff --git a/core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala b/core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala index a91a015299ce0..603f727516277 100644 --- a/core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala +++ b/core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala @@ -21,7 +21,7 @@ import java.util.Properties import scala.collection.Seq import kafka.server.KafkaConfig -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource @@ -30,7 +30,7 @@ class MinIsrConfigTest extends KafkaServerTestHarness { overridingProps.put(KafkaConfig.MinInSyncReplicasProp, "5") def generateConfigs: Seq[KafkaConfig] = TestUtils.createBrokerConfigs(1, zkConnectOrNull).map(KafkaConfig.fromProps(_, overridingProps)) - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDefaultKafkaConfig(quorum: String): Unit = { assert(brokers.head.logManager.initialDefaultConfig.minInSyncReplicas == 5) diff --git a/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala b/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala index ed307eef8fc0b..5935346a0252e 100644 --- a/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala +++ b/core/src/test/scala/unit/kafka/metrics/MetricsTest.scala @@ -55,7 +55,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { val nMessages = 2 - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMetricsReporterAfterDeletingTopic(quorum: String): Unit = { val topic = "test-topic-metric" @@ -65,7 +65,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertEquals(Set.empty, topicMetricGroups(topic), "Topic metrics exists after deleteTopic") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testBrokerTopicMetricsUnregisteredAfterDeletingTopic(quorum: String): Unit = { val topic = "test-broker-topic-metric" @@ -80,7 +80,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertEquals(Set.empty, topicMetricGroups(topic), "Topic metrics exists after deleteTopic") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClusterIdMetric(quorum: String): Unit = { // Check if clusterId metric exists. @@ -88,7 +88,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertEquals(metrics.keySet.asScala.count(_.getMBeanName == s"$requiredKafkaServerPrefix=ClusterId"), 1) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testBrokerStateMetric(quorum: String): Unit = { // Check if BrokerState metric exists. @@ -96,7 +96,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertEquals(metrics.keySet.asScala.count(_.getMBeanName == s"$requiredKafkaServerPrefix=BrokerState"), 1) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testYammerMetricsCountMetric(quorum: String): Unit = { // Check if yammer-metrics-count metric exists. @@ -104,7 +104,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertEquals(metrics.keySet.asScala.count(_.getMBeanName == s"$requiredKafkaServerPrefix=yammer-metrics-count"), 1) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testLinuxIoMetrics(quorum: String): Unit = { // Check if linux-disk-{read,write}-bytes metrics either do or do not exist depending on whether we are or are not @@ -116,7 +116,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertEquals(metrics.keySet.asScala.count(_.getMBeanName == s"$requiredKafkaServerPrefix=$name"), expectedCount)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testJMXFilter(quorum: String): Unit = { // Check if cluster id metrics is not exposed in JMX @@ -126,7 +126,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { .isRegistered(new ObjectName(s"$requiredKafkaServerPrefix=ClusterId"))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUpdateJMXFilter(quorum: String): Unit = { // verify previously exposed metrics are removed and existing matching metrics are added @@ -139,7 +139,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { .isRegistered(new ObjectName(s"$requiredKafkaServerPrefix=ClusterId"))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testGeneralBrokerTopicMetricsAreGreedilyRegistered(quorum: String): Unit = { val topic = "test-broker-topic-metric" @@ -155,7 +155,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertTrue(topicMetricGroups(topic).nonEmpty, "Topic metrics aren't registered") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testWindowsStyleTagNames(quorum: String): Unit = { val path = "C:\\windows-path\\kafka-logs" @@ -165,7 +165,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assert(metric.getMBeanName.endsWith(expectedMBeanName)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testBrokerTopicMetricsBytesInOut(quorum: String): Unit = { val topic = "test-bytes-in-out" @@ -212,7 +212,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertTrue(TestUtils.meterCount(bytesOut) > initialBytesOut) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testZkControllerMetrics(quorum: String): Unit = { val metrics = KafkaYammerMetrics.defaultRegistry.allMetrics @@ -235,7 +235,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { assertEquals(ZkMigrationState.ZK.value().intValue(), zkStateGauge.value()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft")) def testKRaftControllerMetrics(quorum: String): Unit = { val metrics = KafkaYammerMetrics.defaultRegistry.allMetrics @@ -265,7 +265,7 @@ class MetricsTest extends KafkaServerTestHarness with Logging { * Test that the metrics are created with the right name, testZooKeeperStateChangeRateMetrics * and testZooKeeperSessionStateMetric in ZooKeeperClientTest test the metrics behaviour. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSessionExpireListenerMetrics(quorum: String): Unit = { val metrics = KafkaYammerMetrics.defaultRegistry.allMetrics diff --git a/core/src/test/scala/unit/kafka/security/authorizer/AuthorizerTest.scala b/core/src/test/scala/unit/kafka/security/authorizer/AuthorizerTest.scala index 2f2fe4b20472d..5d7a4d3ff3d4e 100644 --- a/core/src/test/scala/unit/kafka/security/authorizer/AuthorizerTest.scala +++ b/core/src/test/scala/unit/kafka/security/authorizer/AuthorizerTest.scala @@ -123,14 +123,14 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAuthorizeThrowsOnNonLiteralResource(quorum: String): Unit = { assertThrows(classOf[IllegalArgumentException], () => authorize(authorizer1, requestContext, READ, new ResourcePattern(TOPIC, "something", PREFIXED))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAuthorizeWithEmptyResourceName(quorum: String): Unit = { assertFalse(authorize(authorizer1, requestContext, READ, new ResourcePattern(GROUP, "", LITERAL))) @@ -139,7 +139,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { } // Authorizing the empty resource is not supported because we create a znode with the resource name. - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testEmptyAclThrowsException(quorum: String): Unit = { val e = assertThrows(classOf[ApiException], @@ -148,7 +148,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertTrue(e.getCause.isInstanceOf[IllegalArgumentException], s"Unexpected exception $e") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testTopicAcl(quorum: String): Unit = { val user1 = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, username) @@ -204,7 +204,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { /** CustomPrincipals should be compared with their principal type and name */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAllowAccessWithCustomPrincipal(quorum: String): Unit = { val user = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, username) @@ -225,7 +225,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertFalse(authorize(authorizer1, host1Context, READ, resource), "User1 should not have READ access from host1 due to denyAcl") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testDenyTakesPrecedence(quorum: String): Unit = { val user = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, username) @@ -241,7 +241,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertFalse(authorize(authorizer1, session, READ, resource), "deny should take precedence over allow.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAllowAllAccess(quorum: String): Unit = { val allowAllAcl = new AccessControlEntry(WILDCARD_PRINCIPAL_STRING, WILDCARD_HOST, AclOperation.ALL, ALLOW) @@ -252,7 +252,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertTrue(authorize(authorizer1, context, READ, resource), "allow all acl should allow access to all.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testSuperUserHasAccess(quorum: String): Unit = { val denyAllAcl = new AccessControlEntry(WILDCARD_PRINCIPAL_STRING, WILDCARD_HOST, AclOperation.ALL, DENY) @@ -269,7 +269,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { /** CustomPrincipals should be compared with their principal type and name */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testSuperUserWithCustomPrincipalHasAccess(quorum: String): Unit = { val denyAllAcl = new AccessControlEntry(WILDCARD_PRINCIPAL_STRING, WILDCARD_HOST, AclOperation.ALL, DENY) @@ -280,7 +280,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertTrue(authorize(authorizer1, session, READ, resource), "superuser with custom principal always has access, no matter what acls.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testWildCardAcls(quorum: String): Unit = { assertFalse(authorize(authorizer1, requestContext, READ, resource), "when acls = [], authorizer should fail close.") @@ -305,13 +305,13 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertFalse(authorize(authorizer1, host1Context, WRITE, resource), "User1 should not have WRITE access from host1") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testNoAclFound(quorum: String): Unit = { assertFalse(authorize(authorizer1, requestContext, READ, resource), "when acls = [], authorizer should deny op.") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testNoAclFoundOverride(quorum: String): Unit = { val props = properties @@ -328,7 +328,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAclConfigWithWhitespace(quorum: String): Unit = { val props = properties @@ -346,7 +346,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAclManagementAPIs(quorum: String): Unit = { val user1 = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, username) @@ -543,7 +543,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { /** * Test ACL inheritance, as described in #{org.apache.kafka.common.acl.AclOperation} */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAclInheritance(quorum: String): Unit = { testImplicationsOfAllow(AclOperation.ALL, Set(READ, WRITE, CREATE, DELETE, ALTER, DESCRIBE, @@ -610,7 +610,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { TestUtils.waitAndVerifyAcls(Set.empty[AccessControlEntry], authorizer2, resource) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAccessAllowedIfAllowAclExistsOnWildcardResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl), wildCardResource) @@ -618,7 +618,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertTrue(authorize(authorizer1, requestContext, READ, resource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testDeleteAclOnWildcardResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl, allowWriteAcl), wildCardResource) @@ -628,7 +628,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(Set(allowWriteAcl), getAcls(authorizer1, wildCardResource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testDeleteAllAclOnWildcardResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl), wildCardResource) @@ -638,7 +638,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(Set.empty, getAcls(authorizer1)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAccessAllowedIfAllowAclExistsOnPrefixedResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl), prefixedResource) @@ -646,7 +646,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertTrue(authorize(authorizer1, requestContext, READ, resource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testDeleteAclOnPrefixedResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl, allowWriteAcl), prefixedResource) @@ -656,7 +656,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(Set(allowWriteAcl), getAcls(authorizer1, prefixedResource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testDeleteAllAclOnPrefixedResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl, allowWriteAcl), prefixedResource) @@ -666,7 +666,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(Set.empty, getAcls(authorizer1)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAddAclsOnLiteralResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl, allowWriteAcl), resource) @@ -677,7 +677,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(Set.empty, getAcls(authorizer1, prefixedResource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAddAclsOnWildcardResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl, allowWriteAcl), wildCardResource) @@ -688,7 +688,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(Set.empty, getAcls(authorizer1, prefixedResource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAddAclsOnPrefixedResource(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl, allowWriteAcl), prefixedResource) @@ -699,7 +699,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(Set.empty, getAcls(authorizer1, resource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAuthorizeWithPrefixedResource(quorum: String): Unit = { addAcls(authorizer1, Set(denyReadAcl), new ResourcePattern(TOPIC, "a_other", LITERAL)) @@ -720,7 +720,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertTrue(authorize(authorizer1, requestContext, READ, resource)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testSingleCharacterResourceAcls(quorum: String): Unit = { addAcls(authorizer1, Set(allowReadAcl), new ResourcePattern(TOPIC, "f", LITERAL)) @@ -733,7 +733,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertFalse(authorize(authorizer1, requestContext, READ, new ResourcePattern(TOPIC, "foo_", LITERAL))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testGetAclsPrincipal(quorum: String): Unit = { val aclOnSpecificPrincipal = new AccessControlEntry(principal.toString, WILDCARD_HOST, WRITE, ALLOW) @@ -754,7 +754,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { assertEquals(0, getAcls(authorizer1, principal).size, "acl on wildcard should not be returned for specific request") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAclsFilter(quorum: String): Unit = { val resource1 = new ResourcePattern(TOPIC, "foo-" + UUID.randomUUID(), LITERAL) @@ -1064,7 +1064,7 @@ class AuthorizerTest extends QuorumTestHarness with BaseAuthorizerTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array(KRAFT, ZK)) def testAuthorizeByResourceTypeNoAclFoundOverride(quorum: String): Unit = { val props = properties diff --git a/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala b/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala index 6daa5e80b3c74..26876aa7d7062 100644 --- a/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala +++ b/core/src/test/scala/unit/kafka/server/AddPartitionsToTxnRequestServerTest.scala @@ -17,7 +17,7 @@ package kafka.server -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import java.util.{Collections, Properties} import java.util.stream.{Stream => JStream} @@ -52,7 +52,7 @@ class AddPartitionsToTxnRequestServerTest extends BaseRequestTest { createTopic(topic1, numPartitions, brokers.size, new Properties()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @MethodSource(value = Array("parameters")) def shouldReceiveOperationNotAttemptedWhenOtherPartitionHasError(quorum: String, version: Short): Unit = { // The basic idea is that we have one unknown topic and one created topic. We should get the 'UNKNOWN_TOPIC_OR_PARTITION' diff --git a/core/src/test/scala/unit/kafka/server/AlterUserScramCredentialsRequestTest.scala b/core/src/test/scala/unit/kafka/server/AlterUserScramCredentialsRequestTest.scala index f45299e9a3e41..4c4e0badb02ec 100644 --- a/core/src/test/scala/unit/kafka/server/AlterUserScramCredentialsRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/AlterUserScramCredentialsRequestTest.scala @@ -75,7 +75,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { private val user3 = "user3@user3.com" private val unknownUser = "unknownUser" - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterNothing(quorum: String): Unit = { val request = new AlterUserScramCredentialsRequest.Builder( @@ -88,7 +88,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { assertEquals(0, results.size) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterSameThingTwice(quorum: String): Unit = { val deletion1 = new AlterUserScramCredentialsRequestData.ScramCredentialDeletion().setName(user1).setMechanism(ScramMechanism.SCRAM_SHA_256.`type`) @@ -129,7 +129,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { }) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterEmptyUser(quorum: String): Unit = { val deletionEmpty = new AlterUserScramCredentialsRequestData.ScramCredentialDeletion().setName("").setMechanism(ScramMechanism.SCRAM_SHA_256.`type`) @@ -158,7 +158,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { }) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterUnknownMechanism(quorum: String): Unit = { val deletionUnknown1 = new AlterUserScramCredentialsRequestData.ScramCredentialDeletion().setName(user1).setMechanism(ScramMechanism.UNKNOWN.`type`) @@ -186,7 +186,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { results.asScala.foreach(result => assertEquals("Unknown SCRAM mechanism", result.errorMessage)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterTooFewIterations(quorum: String): Unit = { val upsertionTooFewIterations = new AlterUserScramCredentialsRequestData.ScramCredentialUpsertion().setName(user1) @@ -203,7 +203,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { assertEquals("Too few iterations", results.get(0).errorMessage) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterTooManyIterations(quorum: String): Unit = { val upsertionTooFewIterations = new AlterUserScramCredentialsRequestData.ScramCredentialUpsertion().setName(user1) @@ -220,7 +220,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { assertEquals("Too many iterations", results.get(0).errorMessage) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDeleteSomethingThatDoesNotExist(quorum: String): Unit = { val request = new AlterUserScramCredentialsRequest.Builder( @@ -247,7 +247,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { checkAllErrorsAlteringCredentials(results, Errors.NOT_CONTROLLER, "when routed incorrectly to a non-Controller broker") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testAlterAndDescribe(quorum: String): Unit = { // create a bunch of credentials @@ -390,7 +390,7 @@ class AlterUserScramCredentialsRequestTest extends BaseRequestTest { /* * Test that SCRAM alter command on KRaft cluster with IBP version less that IBP_3_5 fails */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft-IBP_3_4")) def testMetadataVersionTooLow(quorum: String): Unit = { val upsertionMetadataVersionTooLow = new AlterUserScramCredentialsRequestData.ScramCredentialUpsertion().setName(user1) diff --git a/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala b/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala index c689256696814..424cf9b4f2aca 100644 --- a/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/CreateTopicsRequestTest.scala @@ -32,7 +32,7 @@ import scala.jdk.CollectionConverters._ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest { - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testValidCreateTopicsRequests(quorum: String): Unit = { // Generated assignments @@ -62,7 +62,7 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest { topicReq("topic14", replicationFactor = -1, numPartitions = 2)))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testErrorCreateTopicsRequests(quorum: String): Unit = { val existingTopic = "existing-topic" @@ -103,7 +103,7 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest { validateTopicExists("partial-none") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testCreateTopicsWithVeryShortTimeouts(quorum: String): Unit = { // When using ZooKeeper, we don't expect a request to ever complete within 1ms. @@ -133,7 +133,7 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest { } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidCreateTopicsRequests(quorum: String): Unit = { // Partitions/ReplicationFactor and ReplicaAssignment @@ -148,7 +148,7 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest { Map("bad-args-topic" -> error(Errors.INVALID_REQUEST)), checkErrorMessage = false) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "zkMigration")) def testNotController(quorum: String): Unit = { // Note: we don't run this test when in KRaft mode, because KRaft doesn't have this @@ -159,7 +159,7 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest { assertEquals(1, response.errorCounts().get(error)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testCreateTopicsRequestVersions(quorum: String): Unit = { // Note: we don't run this test when in KRaft mode, because kraft does not yet support returning topic @@ -200,7 +200,7 @@ class CreateTopicsRequestTest extends AbstractCreateTopicsRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCreateClusterMetadataTopic(quorum: String): Unit = { validateErrorCreateTopicsRequests( diff --git a/core/src/test/scala/unit/kafka/server/CreateTopicsRequestWithPolicyTest.scala b/core/src/test/scala/unit/kafka/server/CreateTopicsRequestWithPolicyTest.scala index 3bca6532fc5c4..c51cd6a5a7b35 100644 --- a/core/src/test/scala/unit/kafka/server/CreateTopicsRequestWithPolicyTest.scala +++ b/core/src/test/scala/unit/kafka/server/CreateTopicsRequestWithPolicyTest.scala @@ -19,7 +19,6 @@ package kafka.server import java.util import java.util.Properties -import kafka.utils.TestInfoUtils import org.apache.kafka.common.config.TopicConfig import org.apache.kafka.common.errors.PolicyViolationException import org.apache.kafka.common.internals.Topic @@ -45,7 +44,7 @@ class CreateTopicsRequestWithPolicyTest extends AbstractCreateTopicsRequestTest Seq(properties) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testValidCreateTopicsRequests(quorum: String): Unit = { validateValidCreateTopicsRequests(topicsReq(Seq(topicReq("topic1", @@ -64,7 +63,7 @@ class CreateTopicsRequestWithPolicyTest extends AbstractCreateTopicsRequestTest assignment = Map(0 -> List(1, 0), 1 -> List(0, 1)))))) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testErrorCreateTopicsRequests(quorum: String): Unit = { val existingTopic = "existing-topic" diff --git a/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsOnPlainTextTest.scala b/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsOnPlainTextTest.scala index 78da12581a90e..a64792f8408c9 100644 --- a/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsOnPlainTextTest.scala +++ b/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsOnPlainTextTest.scala @@ -19,7 +19,6 @@ package kafka.server import java.util import kafka.utils.TestUtils -import kafka.utils.TestInfoUtils import org.apache.kafka.clients.admin.{Admin, AdminClientConfig} import org.apache.kafka.common.errors.UnsupportedByAuthenticationException import org.junit.jupiter.api.{AfterEach, BeforeEach, TestInfo} @@ -48,7 +47,7 @@ class DelegationTokenRequestsOnPlainTextTest extends BaseRequestTest { config } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDelegationTokenRequests(quorum: String): Unit = { adminClient = Admin.create(createAdminConfig) diff --git a/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsTest.scala b/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsTest.scala index 8b6443a8aeb99..df8864b4f115a 100644 --- a/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsTest.scala +++ b/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsTest.scala @@ -18,7 +18,7 @@ package kafka.server import kafka.api.IntegrationTestHarness import kafka.api.{KafkaSasl, SaslSetup} -import kafka.utils.{JaasTestUtils, TestUtils, TestInfoUtils} +import kafka.utils.{JaasTestUtils, TestUtils} import org.apache.kafka.clients.admin.{Admin, AdminClientConfig, CreateDelegationTokenOptions, DescribeDelegationTokenOptions} import org.apache.kafka.common.errors.InvalidPrincipalTypeException import org.apache.kafka.common.errors.DelegationTokenNotFoundException @@ -64,7 +64,7 @@ class DelegationTokenRequestsTest extends IntegrationTestHarness with SaslSetup config } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDelegationTokenRequests(quorum: String): Unit = { adminClient = Admin.create(createAdminConfig) diff --git a/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsWithDisableTokenFeatureTest.scala b/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsWithDisableTokenFeatureTest.scala index 75dd3b3fdc861..37f3e58760593 100644 --- a/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsWithDisableTokenFeatureTest.scala +++ b/core/src/test/scala/unit/kafka/server/DelegationTokenRequestsWithDisableTokenFeatureTest.scala @@ -17,7 +17,7 @@ package kafka.server import kafka.api.{KafkaSasl, SaslSetup} -import kafka.utils.{JaasTestUtils, TestUtils, TestInfoUtils} +import kafka.utils.{JaasTestUtils, TestUtils} import org.apache.kafka.clients.admin.{Admin, AdminClientConfig} import org.apache.kafka.common.errors.DelegationTokenDisabledException import org.apache.kafka.common.security.auth.SecurityProtocol @@ -54,7 +54,7 @@ class DelegationTokenRequestsWithDisableTokenFeatureTest extends BaseRequestTest config } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDelegationTokenRequests(quorum: String): Unit = { adminClient = Admin.create(createAdminConfig) diff --git a/core/src/test/scala/unit/kafka/server/DeleteRecordsRequestTest.scala b/core/src/test/scala/unit/kafka/server/DeleteRecordsRequestTest.scala index d43c5c7dfa4b3..d26d3da3bd33d 100644 --- a/core/src/test/scala/unit/kafka/server/DeleteRecordsRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/DeleteRecordsRequestTest.scala @@ -17,7 +17,6 @@ package kafka.server -import kafka.utils.TestInfoUtils import org.apache.kafka.clients.producer.{ProducerRecord, RecordMetadata} import org.apache.kafka.common.TopicPartition import org.apache.kafka.common.message.DeleteRecordsRequestData @@ -37,7 +36,7 @@ class DeleteRecordsRequestTest extends BaseRequestTest { private val TIMEOUT_MS = 1000 private val MESSAGES_PRODUCED_PER_PARTITION = 10 - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteRecordsHappyCase(quorum: String): Unit = { val (topicPartition: TopicPartition, leaderId: Int) = createTopicAndSendRecords @@ -62,7 +61,7 @@ class DeleteRecordsRequestTest extends BaseRequestTest { validateLogStartOffsetForTopic(topicPartition, offsetToDelete) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testErrorWhenDeletingRecordsWithInvalidOffset(quorum: String): Unit = { val (topicPartition: TopicPartition, leaderId: Int) = createTopicAndSendRecords @@ -87,7 +86,7 @@ class DeleteRecordsRequestTest extends BaseRequestTest { validateLogStartOffsetForTopic(topicPartition, 0) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testErrorWhenDeletingRecordsWithInvalidTopic(quorum: String): Unit = { val invalidTopicPartition = new TopicPartition("invalid-topic", 0) diff --git a/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala b/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala index 344d912d58b34..dc2b615c93909 100644 --- a/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala @@ -38,7 +38,7 @@ import scala.jdk.CollectionConverters._ class DeleteTopicsRequestTest extends BaseRequestTest with Logging { - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTopicDeletionClusterHasOfflinePartitions(quorum: String): Unit = { // Create a two topics with one partition/replica. Make one of them offline. @@ -72,7 +72,7 @@ class DeleteTopicsRequestTest extends BaseRequestTest with Logging { "The topics are found in the Broker's cache") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testValidDeleteTopicRequests(quorum: String): Unit = { val timeout = 10000 @@ -129,7 +129,7 @@ class DeleteTopicsRequestTest extends BaseRequestTest with Logging { /* * Only run this test against ZK cluster. The KRaft controller doesn't perform operations that have timed out. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testErrorDeleteTopicRequests(quorum: String): Unit = { val timeout = 30000 @@ -220,7 +220,7 @@ class DeleteTopicsRequestTest extends BaseRequestTest with Logging { * Only run this test against ZK clusters. KRaft doesn't have this behavior of returning NOT_CONTROLLER. * Instead, the request is forwarded. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "zkMigration")) def testNotController(quorum: String): Unit = { val request = new DeleteTopicsRequest.Builder( @@ -248,7 +248,7 @@ class DeleteTopicsRequestTest extends BaseRequestTest with Logging { connectAndReceive[DeleteTopicsResponse](request, destination = socketServer) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testDeleteTopicsVersions(quorum: String): Unit = { // This test assumes that the current valid versions are 0-6 please adjust the test if there are changes. diff --git a/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestWithDeletionDisabledTest.scala b/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestWithDeletionDisabledTest.scala index cb2eb0a01f537..e377256ccc67b 100644 --- a/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestWithDeletionDisabledTest.scala +++ b/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestWithDeletionDisabledTest.scala @@ -47,7 +47,7 @@ class DeleteTopicsRequestWithDeletionDisabledTest extends BaseRequestTest { props.map(KafkaConfig.fromProps) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDeleteRecordsRequest(quorum: String): Unit = { val topic = "topic-1" diff --git a/core/src/test/scala/unit/kafka/server/DescribeClusterRequestTest.scala b/core/src/test/scala/unit/kafka/server/DescribeClusterRequestTest.scala index 04d03c7b98b06..a835c5c4529a7 100644 --- a/core/src/test/scala/unit/kafka/server/DescribeClusterRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/DescribeClusterRequestTest.scala @@ -18,7 +18,6 @@ package kafka.server import kafka.network.SocketServer -import kafka.utils.TestInfoUtils import org.apache.kafka.common.message.{DescribeClusterRequestData, DescribeClusterResponseData} import org.apache.kafka.common.protocol.ApiKeys import org.apache.kafka.common.requests.{DescribeClusterRequest, DescribeClusterResponse} @@ -47,13 +46,13 @@ class DescribeClusterRequestTest extends BaseRequestTest { doSetup(testInfo, createOffsetsTopic = false) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeClusterRequestIncludingClusterAuthorizedOperations(quorum: String): Unit = { testDescribeClusterRequest(true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeClusterRequestExcludingClusterAuthorizedOperations(quorum: String): Unit = { testDescribeClusterRequest(false) diff --git a/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestNotAuthorizedTest.scala b/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestNotAuthorizedTest.scala index 4ab9ba7308702..51cc8effce5cd 100644 --- a/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestNotAuthorizedTest.scala +++ b/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestNotAuthorizedTest.scala @@ -17,7 +17,6 @@ package kafka.server import kafka.network.SocketServer -import kafka.utils.TestInfoUtils import org.apache.kafka.common.message.DescribeUserScramCredentialsRequestData import org.apache.kafka.common.protocol.Errors import org.apache.kafka.common.requests.{DescribeUserScramCredentialsRequest, DescribeUserScramCredentialsResponse} @@ -42,7 +41,7 @@ class DescribeUserScramCredentialsRequestNotAuthorizedTest extends BaseRequestTe properties.put(KafkaConfig.PrincipalBuilderClassProp, classOf[DescribeCredentialsTest.TestPrincipalBuilderReturningUnauthorized].getName) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDescribeNotAuthorized(quorum: String): Unit = { val request = new DescribeUserScramCredentialsRequest.Builder( diff --git a/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestTest.scala b/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestTest.scala index cc8cef1d7b9a5..4c33747d858a6 100644 --- a/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/DescribeUserScramCredentialsRequestTest.scala @@ -55,7 +55,7 @@ class DescribeUserScramCredentialsRequestTest extends BaseRequestTest { super.setUp(testInfo) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDescribeNothing(quorum: String): Unit = { val request = new DescribeUserScramCredentialsRequest.Builder( @@ -67,7 +67,7 @@ class DescribeUserScramCredentialsRequestTest extends BaseRequestTest { assertEquals(0, response.data.results.size, "Expected no credentials when describing everything and there are no credentials") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDescribeWithNull(quorum: String): Unit = { val request = new DescribeUserScramCredentialsRequest.Builder( @@ -89,7 +89,7 @@ class DescribeUserScramCredentialsRequestTest extends BaseRequestTest { assertEquals(Errors.NONE.code, error, "Did not expect controller error when routed to non-controller") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testDescribeSameUserTwice(quorum: String): Unit = { val user = "user1" @@ -105,7 +105,7 @@ class DescribeUserScramCredentialsRequestTest extends BaseRequestTest { assertEquals(s"Cannot describe SCRAM credentials for the same user twice in a single request: $user", result.errorMessage) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft", "zk")) def testUnknownUser(quorum: String): Unit = { val unknownUser = "unknownUser" diff --git a/core/src/test/scala/unit/kafka/server/DynamicConfigChangeTest.scala b/core/src/test/scala/unit/kafka/server/DynamicConfigChangeTest.scala index 1d5c69cfadf59..abe81d9652717 100644 --- a/core/src/test/scala/unit/kafka/server/DynamicConfigChangeTest.scala +++ b/core/src/test/scala/unit/kafka/server/DynamicConfigChangeTest.scala @@ -62,7 +62,7 @@ import scala.jdk.CollectionConverters._ class DynamicConfigChangeTest extends KafkaServerTestHarness { def generateConfigs = List(KafkaConfig.fromProps(TestUtils.createBrokerConfig(0, zkConnectOrNull))) - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConfigChange(quorum: String): Unit = { if (!isKRaftTest()) { @@ -106,7 +106,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDynamicTopicConfigChange(quorum: String): Unit = { val tp = new TopicPartition("test", 0) @@ -148,7 +148,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testMessageFormatVersionChange(quorum: String): Unit = { val tp = new TopicPartition("test", 0) @@ -218,7 +218,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClientIdQuotaConfigChange(quorum: String): Unit = { val m = new util.HashMap[String, String] @@ -226,7 +226,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { testQuotaConfigChange(new ClientQuotaEntity(m), KafkaPrincipal.ANONYMOUS, "testClient") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUserQuotaConfigChange(quorum: String): Unit = { val m = new util.HashMap[String, String] @@ -234,7 +234,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { testQuotaConfigChange(new ClientQuotaEntity(m), KafkaPrincipal.ANONYMOUS, "testClient") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUserClientIdQuotaChange(quorum: String): Unit = { val m = new util.HashMap[String, String] @@ -243,7 +243,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { testQuotaConfigChange(new ClientQuotaEntity(m), KafkaPrincipal.ANONYMOUS, "testClient") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDefaultClientIdQuotaConfigChange(quorum: String): Unit = { val m = new util.HashMap[String, String] @@ -251,7 +251,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { testQuotaConfigChange(new ClientQuotaEntity(m), KafkaPrincipal.ANONYMOUS, "testClient") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDefaultUserQuotaConfigChange(quorum: String): Unit = { val m = new util.HashMap[String, String] @@ -259,7 +259,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { testQuotaConfigChange(new ClientQuotaEntity(m), KafkaPrincipal.ANONYMOUS, "testClient") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testDefaultUserClientIdQuotaConfigChange(quorum: String): Unit = { val m = new util.HashMap[String, String] @@ -268,7 +268,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { testQuotaConfigChange(new ClientQuotaEntity(m), KafkaPrincipal.ANONYMOUS, "testClient") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testQuotaInitialization(quorum: String): Unit = { val server = servers.head @@ -300,7 +300,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { assertEquals(Quota.upperBound(200000), quotaManagers.fetch.quota("ANONYMOUS", "overriddenUserClientId")) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIpQuotaInitialization(quorum: String): Unit = { val broker = brokers.head @@ -340,7 +340,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIpQuotaConfigChange(quorum: String): Unit = { val admin = createAdminClient() @@ -382,7 +382,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testConfigChangeOnNonExistingTopic(quorum: String): Unit = { val topic = TestUtils.tempTopic() @@ -391,7 +391,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { assertThrows(classOf[UnknownTopicOrPartitionException], () => adminZkClient.changeTopicConfig(topic, logProps)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConfigChangeOnNonExistingTopicWithAdminClient(quorum: String): Unit = { val topic = TestUtils.tempTopic() @@ -409,7 +409,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testProcessNotification(quorum: String): Unit = { val props = new Properties() @@ -442,7 +442,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { verify(handler).processConfigChanges(anyString, any[Properties]) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIncrementalAlterDefaultTopicConfig(quorum: String): Unit = { val admin = createAdminClient() @@ -457,7 +457,7 @@ class DynamicConfigChangeTest extends KafkaServerTestHarness { } @nowarn("cat=deprecation") - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAlterDefaultTopicConfig(quorum: String): Unit = { val admin = createAdminClient() diff --git a/core/src/test/scala/unit/kafka/server/EdgeCaseRequestTest.scala b/core/src/test/scala/unit/kafka/server/EdgeCaseRequestTest.scala index 1bbde3ffb6b88..9c41211751b28 100755 --- a/core/src/test/scala/unit/kafka/server/EdgeCaseRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/EdgeCaseRequestTest.scala @@ -117,7 +117,7 @@ class EdgeCaseRequestTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceRequestWithNullClientId(quorum: String): Unit = { val topic = "topic" @@ -163,25 +163,25 @@ class EdgeCaseRequestTest extends KafkaServerTestHarness { assertEquals(Errors.NONE, Errors.forCode(partitionProduceResponse.errorCode), "There should be no error") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testHeaderOnlyRequest(quorum: String): Unit = { verifyDisconnect(requestHeaderBytes(ApiKeys.PRODUCE.id, 1)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidApiKeyRequest(quorum: String): Unit = { verifyDisconnect(requestHeaderBytes(-1, 0)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testInvalidApiVersionRequest(quorum: String): Unit = { verifyDisconnect(requestHeaderBytes(ApiKeys.PRODUCE.id, -1)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMalformedHeaderRequest(quorum: String): Unit = { val serializedBytes = { diff --git a/core/src/test/scala/unit/kafka/server/FetchRequestDownConversionConfigTest.scala b/core/src/test/scala/unit/kafka/server/FetchRequestDownConversionConfigTest.scala index b713e5761090e..df463bf72e5a3 100644 --- a/core/src/test/scala/unit/kafka/server/FetchRequestDownConversionConfigTest.scala +++ b/core/src/test/scala/unit/kafka/server/FetchRequestDownConversionConfigTest.scala @@ -19,7 +19,7 @@ package kafka.server import java.util import java.util.{Optional, Properties} import kafka.network.RequestMetrics.{MessageConversionsTimeMs, TemporaryMemoryBytes} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} import org.apache.kafka.common.config.TopicConfig import org.apache.kafka.common.message.FetchResponseData @@ -148,7 +148,7 @@ class FetchRequestDownConversionConfigTest extends BaseRequestTest { * Tests that "message.downconversion.enable" can be set at topic level, and its configuration is obeyed for client * fetch requests. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testV1FetchFromConsumer(quorum: String): Unit = { testV1Fetch(isFollowerFetch = false) @@ -157,7 +157,7 @@ class FetchRequestDownConversionConfigTest extends BaseRequestTest { /** * Tests that "message.downconversion.enable" has no effect on fetch requests from replicas. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testV1FetchFromReplica(quorum: String): Unit = { testV1Fetch(isFollowerFetch = true) diff --git a/core/src/test/scala/unit/kafka/server/FetchRequestMaxBytesTest.scala b/core/src/test/scala/unit/kafka/server/FetchRequestMaxBytesTest.scala index 581e6e7dbebb4..b9f406f54dd9a 100644 --- a/core/src/test/scala/unit/kafka/server/FetchRequestMaxBytesTest.scala +++ b/core/src/test/scala/unit/kafka/server/FetchRequestMaxBytesTest.scala @@ -17,7 +17,7 @@ package kafka.server -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} import org.apache.kafka.common.config.TopicConfig import org.apache.kafka.common.{TopicPartition, Uuid} @@ -103,7 +103,7 @@ class FetchRequestMaxBytesTest extends BaseRequestTest { * Note that when a single batch is larger than FetchMaxBytes, it will be * returned in full even if this is larger than FetchMaxBytes. See KIP-74. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsumeMultipleRecords(quorum: String): Unit = { createTopics() diff --git a/core/src/test/scala/unit/kafka/server/FetchRequestTest.scala b/core/src/test/scala/unit/kafka/server/FetchRequestTest.scala index cffd1c33dc268..b83030c72861f 100644 --- a/core/src/test/scala/unit/kafka/server/FetchRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/FetchRequestTest.scala @@ -16,7 +16,7 @@ */ package kafka.server -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.producer.ProducerRecord import org.apache.kafka.common.config.TopicConfig import org.apache.kafka.common.protocol.{ApiKeys, Errors} @@ -42,7 +42,7 @@ import scala.util.Random */ class FetchRequestTest extends BaseFetchRequestTest { - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testBrokerRespectsPartitionsOrderAndSizeLimits(quorum: String): Unit = { initProducer() @@ -145,7 +145,7 @@ class FetchRequestTest extends BaseFetchRequestTest { evaluateResponse4(fetchResponse4V12, 12) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testFetchRequestV4WithReadCommitted(quorum: String): Unit = { initProducer() @@ -164,7 +164,7 @@ class FetchRequestTest extends BaseFetchRequestTest { assertTrue(records(partitionData).map(_.sizeInBytes).sum > 0) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testFetchRequestToNonReplica(quorum: String): Unit = { val topic = "topic" @@ -195,13 +195,13 @@ class FetchRequestTest extends BaseFetchRequestTest { assertEquals(Errors.NOT_LEADER_OR_FOLLOWER.code, oldPartitionData.errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testLastFetchedEpochValidation(quorum: String): Unit = { checkLastFetchedEpochValidation(ApiKeys.FETCH.latestVersion()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testLastFetchedEpochValidationV12(quorum: String): Unit = { checkLastFetchedEpochValidation(12) @@ -250,13 +250,13 @@ class FetchRequestTest extends BaseFetchRequestTest { assertEquals(firstEpochEndOffset, divergingEpoch.endOffset) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testCurrentEpochValidation(quorum: String): Unit = { checkCurrentEpochValidation(ApiKeys.FETCH.latestVersion()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testCurrentEpochValidationV12(quorum: String): Unit = { checkCurrentEpochValidation(12) @@ -300,13 +300,13 @@ class FetchRequestTest extends BaseFetchRequestTest { assertResponseErrorForEpoch(Errors.FENCED_LEADER_EPOCH, followerId, Optional.of(secondLeaderEpoch - 1)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testEpochValidationWithinFetchSession(quorum: String): Unit = { checkEpochValidationWithinFetchSession(ApiKeys.FETCH.latestVersion()) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testEpochValidationWithinFetchSessionV12(quorum: String): Unit = { checkEpochValidationWithinFetchSession(12) @@ -368,7 +368,7 @@ class FetchRequestTest extends BaseFetchRequestTest { * in the server. The client closes its connection after reading partial data when the * channel is muted in the server. If buffers are not released this will result in OOM. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testDownConversionWithConnectionFailure(quorum: String): Unit = { val (topicPartition, leaderId) = createTopics(numTopics = 1, numPartitions = 1).head @@ -436,7 +436,7 @@ class FetchRequestTest extends BaseFetchRequestTest { * record batch to multiple v0/v1 record batches with size 1. If the fetch offset points to inside the record batch, * some records have to be dropped during the conversion. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testDownConversionFromBatchedToUnbatchedRespectsOffset(quorum: String): Unit = { // Increase linger so that we have control over the batches created @@ -518,7 +518,7 @@ class FetchRequestTest extends BaseFetchRequestTest { * those partitions are returned in all incremental fetch requests. * This tests using FetchRequests that don't use topic IDs */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testCreateIncrementalFetchWithPartitionsInErrorV12(quorum: String): Unit = { def createConsumerFetchRequest(topicPartitions: Seq[TopicPartition], @@ -581,7 +581,7 @@ class FetchRequestTest extends BaseFetchRequestTest { /** * Test that when a Fetch Request receives an unknown topic ID, it returns a top level error. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testFetchWithPartitionsWithIdError(quorum: String): Unit = { def createConsumerFetchRequest(fetchData: util.LinkedHashMap[TopicPartition, FetchRequest.PartitionData], @@ -626,7 +626,7 @@ class FetchRequestTest extends BaseFetchRequestTest { assertEquals(Errors.UNKNOWN_TOPIC_ID.code, responseData1.get(bar0).errorCode) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testZStdCompressedTopic(quorum: String): Unit = { // ZSTD compressed topic @@ -674,7 +674,7 @@ class FetchRequestTest extends BaseFetchRequestTest { assertEquals(3, records(data2).size) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk","kraft")) def testZStdCompressedRecords(quorum: String): Unit = { // Producer compressed topic diff --git a/core/src/test/scala/unit/kafka/server/KafkaMetricReporterExceptionHandlingTest.scala b/core/src/test/scala/unit/kafka/server/KafkaMetricReporterExceptionHandlingTest.scala index 570db86498d73..5b7509a2a3ee4 100644 --- a/core/src/test/scala/unit/kafka/server/KafkaMetricReporterExceptionHandlingTest.scala +++ b/core/src/test/scala/unit/kafka/server/KafkaMetricReporterExceptionHandlingTest.scala @@ -14,7 +14,7 @@ package kafka.server -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.common.config.internals.QuotaConfigs import org.apache.kafka.common.message.ListGroupsRequestData import org.apache.kafka.common.metrics.{KafkaMetric, MetricsReporter} @@ -62,7 +62,7 @@ class KafkaMetricReporterExceptionHandlingTest extends BaseRequestTest { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testBothReportersAreInvoked(quorum: String): Unit = { val port = anySocketServer.boundPort(ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT)) diff --git a/core/src/test/scala/unit/kafka/server/KafkaMetricsReporterTest.scala b/core/src/test/scala/unit/kafka/server/KafkaMetricsReporterTest.scala index db13f22535909..8b301cbdb351c 100644 --- a/core/src/test/scala/unit/kafka/server/KafkaMetricsReporterTest.scala +++ b/core/src/test/scala/unit/kafka/server/KafkaMetricsReporterTest.scala @@ -18,7 +18,7 @@ package kafka.server import java.util import java.util.concurrent.atomic.AtomicReference -import kafka.utils.{CoreUtils, TestInfoUtils, TestUtils} +import kafka.utils.{CoreUtils, TestUtils} import org.apache.kafka.common.metrics.{KafkaMetric, MetricsContext, MetricsReporter} import org.junit.jupiter.api.{AfterEach, BeforeEach, TestInfo} import org.junit.jupiter.api.Assertions._ @@ -78,7 +78,7 @@ class KafkaMetricsReporterTest extends QuorumTestHarness { broker.startup() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testMetricsContextNamespacePresent(quorum: String): Unit = { assertNotNull(KafkaMetricsReporterTest.MockMetricsReporter.CLUSTERID.get()) diff --git a/core/src/test/scala/unit/kafka/server/LogDirFailureTest.scala b/core/src/test/scala/unit/kafka/server/LogDirFailureTest.scala index 54a10d78c76e8..956450d74b6e5 100644 --- a/core/src/test/scala/unit/kafka/server/LogDirFailureTest.scala +++ b/core/src/test/scala/unit/kafka/server/LogDirFailureTest.scala @@ -22,7 +22,7 @@ import java.util.concurrent.{ExecutionException, TimeUnit} import kafka.api.IntegrationTestHarness import kafka.controller.{OfflineReplica, PartitionAndReplica} import kafka.utils.TestUtils.{Checkpoint, LogDirFailureType, Roll, waitUntilTrue} -import kafka.utils.{CoreUtils, Exit, TestInfoUtils, TestUtils} +import kafka.utils.{CoreUtils, Exit, TestUtils} import org.apache.kafka.clients.consumer.Consumer import org.apache.kafka.clients.producer.{ProducerConfig, ProducerRecord} import org.apache.kafka.common.TopicPartition @@ -59,13 +59,13 @@ class LogDirFailureTest extends IntegrationTestHarness { ensureConsistentKRaftMetadata() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceErrorFromFailureOnLogRoll(quorum: String): Unit = { testProduceErrorsFromLogDirFailureOnLeader(Roll) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIOExceptionDuringLogRoll(quorum: String): Unit = { testProduceAfterLogDirFailureOnLeader(Roll, quorum) @@ -102,19 +102,19 @@ class LogDirFailureTest extends IntegrationTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceErrorFromFailureOnCheckpoint(quorum: String): Unit = { testProduceErrorsFromLogDirFailureOnLeader(Checkpoint) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIOExceptionDuringCheckpoint(quorum: String): Unit = { testProduceAfterLogDirFailureOnLeader(Checkpoint, quorum) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testReplicaFetcherThreadAfterLogDirFailureOnFollower(quorum: String): Unit = { this.producerConfig.setProperty(ProducerConfig.RETRIES_CONFIG, "0") diff --git a/core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala b/core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala index 531100408852a..6d1de99f6e651 100755 --- a/core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala +++ b/core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala @@ -20,9 +20,8 @@ import java.util.Properties import scala.collection.Seq -import kafka.utils.{TestUtils, TestInfoUtils} +import kafka.utils.TestUtils import TestUtils._ -import kafka.server.QuorumTestHarness import java.io.File import kafka.server.checkpoints.OffsetCheckpointFile @@ -106,7 +105,7 @@ class LogRecoveryTest extends QuorumTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testHWCheckpointNoFailuresSingleLogSegment(quorum: String): Unit = { val numMessages = 2L @@ -124,7 +123,7 @@ class LogRecoveryTest extends QuorumTestHarness { assertEquals(numMessages, followerHW) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testHWCheckpointWithFailuresSingleLogSegment(quorum: String): Unit = { var leader = getLeaderIdForPartition(servers, topicPartition) @@ -185,7 +184,7 @@ class LogRecoveryTest extends QuorumTestHarness { assertEquals(hw, hwFile2.read().getOrElse(topicPartition, 0L)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testHWCheckpointNoFailuresMultipleLogSegments(quorum: String): Unit = { sendMessages(20) @@ -202,7 +201,7 @@ class LogRecoveryTest extends QuorumTestHarness { assertEquals(hw, followerHW) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testHWCheckpointWithFailuresMultipleLogSegments(quorum: String): Unit = { var leader = getLeaderIdForPartition(servers, topicPartition) diff --git a/core/src/test/scala/unit/kafka/server/MetadataRequestTest.scala b/core/src/test/scala/unit/kafka/server/MetadataRequestTest.scala index 7b9576026c180..6d0bd4c9f80ad 100644 --- a/core/src/test/scala/unit/kafka/server/MetadataRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/MetadataRequestTest.scala @@ -18,7 +18,7 @@ package kafka.server import java.util.Optional -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.common.Uuid import org.apache.kafka.common.errors.UnsupportedVersionException import org.apache.kafka.common.internals.Topic @@ -41,7 +41,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { doSetup(testInfo, createOffsetsTopic = false) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClusterIdWithRequestVersion1(quorum: String): Unit = { val v1MetadataResponse = sendMetadataRequest(MetadataRequest.Builder.allTopics.build(1.toShort)) @@ -49,7 +49,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { assertNull(v1ClusterId, s"v1 clusterId should be null") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testClusterIdIsValid(quorum: String): Unit = { val metadataResponse = sendMetadataRequest(MetadataRequest.Builder.allTopics.build(2.toShort)) @@ -60,7 +60,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { * This test only runs in ZK mode because in KRaft mode, the controller ID visible to * the client is randomized. */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testControllerId(quorum: String): Unit = { val controllerServer = servers.find(_.kafkaController.isActive).get @@ -83,7 +83,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { }, "Controller id should match the active controller after failover", 5000) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testRack(quorum: String): Unit = { val metadataResponse = sendMetadataRequest(MetadataRequest.Builder.allTopics.build(1.toShort)) @@ -93,7 +93,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIsInternal(quorum: String): Unit = { val internalTopic = Topic.GROUP_METADATA_TOPIC_NAME @@ -115,7 +115,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { assertEquals(Set(internalTopic).asJava, metadataResponse.buildCluster().internalTopics) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testNoTopicsRequest(quorum: String): Unit = { // create some topics @@ -129,7 +129,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { assertTrue(metadataResponse.topicMetadata.isEmpty, "Response should have no topics") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAutoTopicCreation(quorum: String): Unit = { val topic1 = "t1" @@ -160,7 +160,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAutoCreateTopicWithInvalidReplicationFactor(quorum: String): Unit = { // Shutdown all but one broker so that the number of brokers is less than the default replication factor @@ -180,7 +180,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { assertEquals(0, topicMetadata.partitionMetadata.size) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testAutoCreateOfCollidingTopics(quorum: String): Unit = { val topic1 = "testAutoCreate.Topic" @@ -211,7 +211,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { assertTrue(partitionMetadata.leaderId.get >= 0) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAllTopicsRequest(quorum: String): Unit = { // create some topics @@ -229,7 +229,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { assertEquals(2, metadataResponseV1.topicMetadata.size(), "V1 Response should have 2 (all) topics") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testTopicIdsInResponse(quorum: String): Unit = { val replicaAssignment = Map(0 -> Seq(1, 2, 0), 1 -> Seq(2, 0, 1)) @@ -259,7 +259,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { /** * Preferred replica should be the first item in the replicas list */ - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testPreferredReplica(quorum: String): Unit = { val replicaAssignment = Map(0 -> Seq(1, 2, 0), 1 -> Seq(2, 0, 1)) @@ -283,7 +283,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testReplicaDownResponse(quorum: String): Unit = { val replicaDownTopic = "replicaDown" @@ -329,7 +329,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { assertEquals(replicaCount, v1PartitionMetadata.replicaIds.size, s"Response should have $replicaCount replicas") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testIsrAfterBrokerShutDownAndJoinsBack(quorum: String): Unit = { def checkIsr[B <: KafkaBroker]( @@ -367,7 +367,7 @@ class MetadataRequestTest extends AbstractMetadataRequestTest { checkIsr(brokers, topic) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testAliveBrokersWithNoTopics(quorum: String): Unit = { def checkMetadata[B <: KafkaBroker]( diff --git a/core/src/test/scala/unit/kafka/server/OffsetsForLeaderEpochRequestTest.scala b/core/src/test/scala/unit/kafka/server/OffsetsForLeaderEpochRequestTest.scala index 00ca644dcf3ba..dc49cde68dc33 100644 --- a/core/src/test/scala/unit/kafka/server/OffsetsForLeaderEpochRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/OffsetsForLeaderEpochRequestTest.scala @@ -17,7 +17,7 @@ package kafka.server import java.util.Optional -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.common.TopicPartition import org.apache.kafka.common.message.OffsetForLeaderEpochRequestData.OffsetForLeaderPartition import org.apache.kafka.common.message.OffsetForLeaderEpochRequestData.OffsetForLeaderTopic @@ -33,7 +33,7 @@ import scala.jdk.CollectionConverters._ class OffsetsForLeaderEpochRequestTest extends BaseRequestTest { - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testOffsetsForLeaderEpochErrorCodes(quorum: String): Unit = { val topic = "topic" @@ -58,7 +58,7 @@ class OffsetsForLeaderEpochRequestTest extends BaseRequestTest { assertResponseError(Errors.NOT_LEADER_OR_FOLLOWER, nonReplica, request) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCurrentEpochValidation(quorum: String): Unit = { val topic = "topic" diff --git a/core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala b/core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala index 85a11c20976b9..ee8d3c6b6b643 100644 --- a/core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala +++ b/core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala @@ -19,7 +19,7 @@ package kafka.server import java.nio.ByteBuffer import java.util.{Collections, Properties} -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.common.TopicPartition import org.apache.kafka.common.config.TopicConfig import org.apache.kafka.common.message.ProduceRequestData @@ -44,7 +44,7 @@ class ProduceRequestTest extends BaseRequestTest { val metricsKeySet = KafkaYammerMetrics.defaultRegistry.allMetrics.keySet.asScala - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testSimpleProduceRequest(quorum: String): Unit = { val (partition, leader) = createTopicAndFindPartitionWithLeader("topic") @@ -129,7 +129,7 @@ class ProduceRequestTest extends BaseRequestTest { assertEquals("One or more records have been rejected due to invalid timestamp", partitionProduceResponse.errorMessage) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testProduceToNonReplica(quorum: String): Unit = { val topic = "topic" @@ -172,7 +172,7 @@ class ProduceRequestTest extends BaseRequestTest { }.getOrElse(throw new AssertionError(s"No leader elected for topic $topic")) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCorruptLz4ProduceRequest(quorum: String): Unit = { val (partition, leader) = createTopicAndFindPartitionWithLeader("topic") @@ -207,7 +207,7 @@ class ProduceRequestTest extends BaseRequestTest { assertTrue(TestUtils.meterCount(s"${BrokerTopicStats.InvalidMessageCrcRecordsPerSec}") > 0) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testZSTDProduceRequest(quorum: String): Unit = { val topic = "topic" diff --git a/core/src/test/scala/unit/kafka/server/ReplicaFetchTest.scala b/core/src/test/scala/unit/kafka/server/ReplicaFetchTest.scala index eaeb76f03eee2..34a165c0bd017 100644 --- a/core/src/test/scala/unit/kafka/server/ReplicaFetchTest.scala +++ b/core/src/test/scala/unit/kafka/server/ReplicaFetchTest.scala @@ -18,7 +18,7 @@ package kafka.server import org.junit.jupiter.api.AfterEach -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import TestUtils._ import kafka.api.IntegrationTestHarness import org.apache.kafka.clients.producer.ProducerRecord @@ -39,7 +39,7 @@ class ReplicaFetchTest extends IntegrationTestHarness { override def brokerCount: Int = 2 - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testReplicaFetcherThread(quorum: String): Unit = { val partition = 0 diff --git a/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala b/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala index 80494ae38deef..8f0f14d49b851 100644 --- a/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala +++ b/core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala @@ -33,7 +33,7 @@ import kafka.log._ import kafka.server.QuotaFactory.{QuotaManagers, UnboundedQuota} import kafka.server.checkpoints.{LazyOffsetCheckpoints, OffsetCheckpointFile} import kafka.server.epoch.util.MockBlockingSender -import kafka.utils.{Exit, Pool, TestInfoUtils, TestUtils} +import kafka.utils.{Exit, Pool, TestUtils} import org.apache.kafka.clients.FetchSessionHandler import org.apache.kafka.common.errors.{InvalidPidMappingException, KafkaStorageException} import org.apache.kafka.common.message.LeaderAndIsrRequestData @@ -3885,7 +3885,7 @@ class ReplicaManagerTest { testStopReplicaWithExistingPartition(LeaderAndIsr.NoEpoch, true, false, Errors.NONE, enableRemoteStorage) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(booleans = Array(true, false)) def testOffsetOutOfRangeExceptionWhenReadFromLog(isFromFollower: Boolean): Unit = { val replicaId = if (isFromFollower) 1 else -1 @@ -3940,7 +3940,7 @@ class ReplicaManagerTest { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(booleans = Array(true, false)) def testOffsetOutOfRangeExceptionWhenFetchMessages(isFromFollower: Boolean): Unit = { val replicaId = if (isFromFollower) 1 else -1 diff --git a/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala b/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala index 1668c4d8eaa9f..d9db91dda1fce 100644 --- a/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala +++ b/core/src/test/scala/unit/kafka/server/ReplicationQuotasTest.scala @@ -25,7 +25,7 @@ import kafka.server.KafkaConfig.fromProps import kafka.server.QuotaType._ import kafka.utils.TestUtils._ import kafka.utils.CoreUtils._ -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.clients.admin.AlterConfigOp.OpType.SET import org.apache.kafka.clients.admin.{AlterConfigOp, ConfigEntry, NewTopic} import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} @@ -69,13 +69,13 @@ class ReplicationQuotasTest extends QuorumTestHarness { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldBootstrapTwoBrokersWithLeaderThrottle(quorum: String): Unit = { shouldMatchQuotaReplicatingThroughAnAsymmetricTopology(true) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldBootstrapTwoBrokersWithFollowerThrottle(quorum: String): Unit = { shouldMatchQuotaReplicatingThroughAnAsymmetricTopology(false) @@ -211,7 +211,7 @@ class ReplicationQuotasTest extends QuorumTestHarness { def tp(partition: Int): TopicPartition = new TopicPartition(topic, partition) - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldThrottleOldSegments(quorum: String): Unit = { /** diff --git a/core/src/test/scala/unit/kafka/server/RequestQuotaTest.scala b/core/src/test/scala/unit/kafka/server/RequestQuotaTest.scala index 5ced592137c70..7414c009f554e 100644 --- a/core/src/test/scala/unit/kafka/server/RequestQuotaTest.scala +++ b/core/src/test/scala/unit/kafka/server/RequestQuotaTest.scala @@ -16,7 +16,7 @@ package kafka.server import kafka.api.LeaderAndIsr import kafka.security.authorizer.AclAuthorizer -import kafka.utils.{TestInfoUtils, TestUtils} +import kafka.utils.TestUtils import org.apache.kafka.common._ import org.apache.kafka.common.acl._ import org.apache.kafka.common.config.internals.QuotaConfigs @@ -140,7 +140,7 @@ class RequestQuotaTest extends BaseRequestTest { finally super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testResponseThrottleTime(quorum: String): Unit = { for (apiKey <- clientActions ++ clusterActionsWithThrottleForBroker) @@ -149,21 +149,21 @@ class RequestQuotaTest extends BaseRequestTest { waitAndCheckResults() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testResponseThrottleTimeWhenBothProduceAndRequestQuotasViolated(quorum: String): Unit = { submitTest(ApiKeys.PRODUCE, () => checkSmallQuotaProducerRequestThrottleTime()) waitAndCheckResults() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testResponseThrottleTimeWhenBothFetchAndRequestQuotasViolated(quorum: String): Unit = { submitTest(ApiKeys.FETCH, () => checkSmallQuotaConsumerRequestThrottleTime()) waitAndCheckResults() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnthrottledClient(quorum: String): Unit = { for (apiKey <- clientActions) { @@ -173,7 +173,7 @@ class RequestQuotaTest extends BaseRequestTest { waitAndCheckResults() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testExemptRequestTime(quorum: String): Unit = { // Exclude `DESCRIBE_QUORUM`, maybe it shouldn't be a cluster action @@ -185,7 +185,7 @@ class RequestQuotaTest extends BaseRequestTest { waitAndCheckResults() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testUnauthorizedThrottle(quorum: String): Unit = { RequestQuotaTest.principal = RequestQuotaTest.UnauthorizedPrincipal diff --git a/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala b/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala index f6d0853d56f26..d8114977d85ba 100644 --- a/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala +++ b/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala @@ -16,7 +16,7 @@ */ package kafka.server -import kafka.utils.{CoreUtils, Exit, TestInfoUtils, TestUtils} +import kafka.utils.{CoreUtils, Exit, TestUtils} import java.io.{DataInputStream, File} import java.net.ServerSocket @@ -83,7 +83,7 @@ class ServerShutdownTest extends KafkaServerTestHarness { super.setUp(testInfo) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCleanShutdown(quorum: String): Unit = { @@ -142,7 +142,7 @@ class ServerShutdownTest extends KafkaServerTestHarness { producer.close() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testCleanShutdownAfterFailedStartup(quorum: String): Unit = { if (isKRaftTest()) { @@ -157,7 +157,7 @@ class ServerShutdownTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testNoCleanShutdownAfterFailedStartupDueToCorruptLogs(quorum: String): Unit = { createTopic(topic) @@ -188,7 +188,7 @@ class ServerShutdownTest extends KafkaServerTestHarness { } } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testCleanShutdownWithZkUnavailable(quorum: String): Unit = { shutdownZooKeeper() @@ -198,7 +198,7 @@ class ServerShutdownTest extends KafkaServerTestHarness { } @Disabled - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("kraft")) def testCleanShutdownWithKRaftControllerUnavailable(quorum: String): Unit = { shutdownKRaftController() @@ -244,7 +244,7 @@ class ServerShutdownTest extends KafkaServerTestHarness { .count(isNonDaemonKafkaThread)) } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def testConsecutiveShutdown(quorum: String): Unit = { shutdownBroker() @@ -254,7 +254,7 @@ class ServerShutdownTest extends KafkaServerTestHarness { // Verify that if controller is in the midst of processing a request, shutdown completes // without waiting for request timeout. Since this involves LeaderAndIsr request, it is // ZK-only for now. - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk")) def testControllerShutdownDuringSend(quorum: String): Unit = { val securityProtocol = SecurityProtocol.PLAINTEXT diff --git a/core/src/test/scala/unit/kafka/server/epoch/LeaderEpochIntegrationTest.scala b/core/src/test/scala/unit/kafka/server/epoch/LeaderEpochIntegrationTest.scala index ba0becd4eecff..46f6f6618988e 100644 --- a/core/src/test/scala/unit/kafka/server/epoch/LeaderEpochIntegrationTest.scala +++ b/core/src/test/scala/unit/kafka/server/epoch/LeaderEpochIntegrationTest.scala @@ -21,7 +21,7 @@ import kafka.server.KafkaConfig._ import kafka.server.{BlockingSend, BrokerBlockingSender, KafkaBroker, QuorumTestHarness} import kafka.utils.Implicits._ import kafka.utils.TestUtils._ -import kafka.utils.{Logging, TestInfoUtils, TestUtils} +import kafka.utils.{Logging, TestUtils} import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} import org.apache.kafka.common.metrics.Metrics import org.apache.kafka.common.protocol.Errors._ @@ -64,7 +64,7 @@ class LeaderEpochIntegrationTest extends QuorumTestHarness with Logging { super.tearDown() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldAddCurrentLeaderEpochToMessagesAsTheyAreWrittenToLeader(quorum: String): Unit = { brokers ++= (0 to 1).map { id => createBroker(fromProps(createBrokerConfig(id, zkConnectOrNull))) } @@ -97,7 +97,7 @@ class LeaderEpochIntegrationTest extends QuorumTestHarness with Logging { waitUntilTrue(() => messagesHaveLeaderEpoch(brokers(0), expectedLeaderEpoch, 4), "Leader epoch should be 1") } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldSendLeaderEpochRequestAndGetAResponse(quorum: String): Unit = { @@ -145,7 +145,7 @@ class LeaderEpochIntegrationTest extends QuorumTestHarness with Logging { fetcher1.close() } - @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumName) + @ParameterizedTest @ValueSource(strings = Array("zk", "kraft")) def shouldIncreaseLeaderEpochBetweenLeaderRestarts(quorum: String): Unit = { //Setup: we are only interested in the single partition on broker 101