Skip to content

Commit fcca405

Browse files
KAFKA-18975 Move clients-integration-test out of core module (#19217)
Move following tests from core to clients-integration-test module. - ClientTelemetryTest - DeleteTopicTest - DescribeAuthorizedOperationsTest - ConsumerIntegrationTest - CustomQuotaCallbackTest - RackAwareAutoTopicCreationTest Move following tests from core to server module. - BootstrapControllersIntegrationTest - LogManagerIntegrationTest Reviewers: Kirk True <kirk@kirktrue.pro>, Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
1 parent 3a3159b commit fcca405

10 files changed

Lines changed: 26 additions & 46 deletions

File tree

build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,8 @@ project(':server') {
911911
testImplementation libs.mockitoCore
912912
testImplementation libs.junitJupiter
913913
testImplementation testLog4j2Libs
914+
testImplementation project(':test-common:test-common-internal-api')
915+
testImplementation project(':test-common:test-common-runtime')
914916

915917
testRuntimeOnly runtimeTestLibs
916918
}
@@ -1972,9 +1974,13 @@ project(':clients:clients-integration-tests') {
19721974
testImplementation libs.slf4jApi
19731975
testImplementation project(':test-common:test-common-internal-api')
19741976
testImplementation project(':test-common:test-common-runtime')
1977+
testImplementation project(':metadata')
1978+
testImplementation project(':server')
1979+
testImplementation project(':storage')
1980+
testImplementation project(':core').sourceSets.test.output
1981+
testImplementation project(':clients').sourceSets.test.output
19751982
implementation project(':server-common')
19761983
testImplementation project(':metadata')
1977-
implementation project(':clients').sourceSets.test.output
19781984
implementation project(':group-coordinator')
19791985
implementation project(':transaction-coordinator')
19801986

checkstyle/import-control-server.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
<allow pkg="org.apache.kafka.server" />
8585
<allow pkg="org.apache.kafka.image" />
8686
<allow pkg="org.apache.kafka.storage.internals.log" />
87+
<allow pkg="org.apache.kafka.storage.internals.checkpoint" />
8788
<subpackage name="metrics">
8889
<allow class="org.apache.kafka.server.authorizer.AuthorizableRequestContext" />
8990
<allow pkg="org.apache.kafka.server.telemetry" />

core/src/test/java/kafka/admin/ClientTelemetryTest.java renamed to clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/ClientTelemetryTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
* limitations under the License.
1616
*/
1717

18-
package kafka.admin;
18+
package org.apache.kafka.clients.admin;
19+
20+
import kafka.admin.ConfigCommand;
1921

20-
import org.apache.kafka.clients.admin.Admin;
21-
import org.apache.kafka.clients.admin.AdminClientConfig;
22-
import org.apache.kafka.clients.admin.NewTopic;
2322
import org.apache.kafka.clients.consumer.Consumer;
2423
import org.apache.kafka.clients.consumer.ConsumerConfig;
2524
import org.apache.kafka.clients.consumer.ConsumerRecord;
@@ -71,7 +70,7 @@ public class ClientTelemetryTest {
7170
types = Type.KRAFT,
7271
brokers = 3,
7372
serverProperties = {
74-
@ClusterConfigProperty(key = METRIC_REPORTER_CLASSES_CONFIG, value = "kafka.admin.ClientTelemetryTest$GetIdClientTelemetry"),
73+
@ClusterConfigProperty(key = METRIC_REPORTER_CLASSES_CONFIG, value = "org.apache.kafka.clients.admin.ClientTelemetryTest$GetIdClientTelemetry"),
7574
})
7675
public void testClientInstanceId(ClusterInstance clusterInstance) throws InterruptedException, ExecutionException {
7776
Map<String, Object> configs = new HashMap<>();
@@ -159,7 +158,7 @@ private static String[] toArray(List<String>... lists) {
159158

160159
/**
161160
* We should add a ClientTelemetry into plugins to test the clientInstanceId method Otherwise the
162-
* {@link org.apache.kafka.common.protocol.ApiKeys.GET_TELEMETRY_SUBSCRIPTIONS } command will not be supported
161+
* {@link org.apache.kafka.common.protocol.ApiKeys#GET_TELEMETRY_SUBSCRIPTIONS} command will not be supported
163162
* by the server
164163
**/
165164
public static class GetIdClientTelemetry implements ClientTelemetry, MetricsReporter {

core/src/test/java/kafka/admin/DeleteTopicTest.java renamed to clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/DeleteTopicTest.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,10 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package kafka.admin;
17+
package org.apache.kafka.clients.admin;
1818

1919
import kafka.server.KafkaBroker;
2020

21-
import org.apache.kafka.clients.admin.Admin;
22-
import org.apache.kafka.clients.admin.AdminClientConfig;
23-
import org.apache.kafka.clients.admin.NewPartitionReassignment;
24-
import org.apache.kafka.clients.admin.NewPartitions;
25-
import org.apache.kafka.clients.admin.NewTopic;
2621
import org.apache.kafka.common.TopicPartition;
2722
import org.apache.kafka.common.compress.Compression;
2823
import org.apache.kafka.common.errors.TopicDeletionDisabledException;
@@ -53,8 +48,6 @@
5348
import java.util.function.Supplier;
5449
import java.util.stream.Collectors;
5550

56-
import scala.jdk.javaapi.OptionConverters;
57-
5851
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
5952
import static org.junit.jupiter.api.Assertions.assertThrows;
6053
import static org.junit.jupiter.api.Assertions.fail;
@@ -322,8 +315,8 @@ private void waitForReplicaDeleted(Map<Integer, KafkaBroker> clusters,
322315
private Supplier<Optional<Integer>> isLeaderKnown(Map<Integer, KafkaBroker> idToBroker, TopicPartition topicPartition) {
323316
return () -> idToBroker.values()
324317
.stream()
325-
.filter(broker -> OptionConverters.toJava(broker.replicaManager().onlinePartition(topicPartition))
326-
.stream().anyMatch(tp -> tp.leaderIdIfLocal().isDefined()))
318+
.filter(broker -> broker.replicaManager().onlinePartition(topicPartition)
319+
.exists(tp -> tp.leaderIdIfLocal().isDefined()))
327320
.map(broker -> broker.config().brokerId())
328321
.findFirst();
329322
}

core/src/test/java/kafka/admin/DescribeAuthorizedOperationsTest.java renamed to clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/DescribeAuthorizedOperationsTest.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
package kafka.admin;
18+
package org.apache.kafka.clients.admin;
1919

2020
import org.apache.kafka.clients.CommonClientConfigs;
21-
import org.apache.kafka.clients.admin.Admin;
22-
import org.apache.kafka.clients.admin.ConsumerGroupDescription;
23-
import org.apache.kafka.clients.admin.DescribeClusterOptions;
24-
import org.apache.kafka.clients.admin.DescribeConsumerGroupsOptions;
25-
import org.apache.kafka.clients.admin.DescribeConsumerGroupsResult;
26-
import org.apache.kafka.clients.admin.DescribeTopicsOptions;
27-
import org.apache.kafka.clients.admin.NewTopic;
28-
import org.apache.kafka.clients.admin.TopicDescription;
2921
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
3022
import org.apache.kafka.common.TopicPartition;
3123
import org.apache.kafka.common.acl.AccessControlEntry;

core/src/test/java/kafka/admin/RackAwareAutoTopicCreationTest.java renamed to clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/RackAwareAutoTopicCreationTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package kafka.admin;
17+
package org.apache.kafka.clients.admin;
1818

19-
import org.apache.kafka.clients.admin.Admin;
20-
import org.apache.kafka.clients.admin.TopicDescription;
2119
import org.apache.kafka.clients.producer.Producer;
2220
import org.apache.kafka.clients.producer.ProducerRecord;
2321
import org.apache.kafka.common.Node;

core/src/test/java/kafka/clients/consumer/ConsumerIntegrationTest.java renamed to clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ConsumerIntegrationTest.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package kafka.clients.consumer;
18-
19-
import org.apache.kafka.clients.consumer.ConsumerConfig;
20-
import org.apache.kafka.clients.consumer.ConsumerRebalanceListener;
21-
import org.apache.kafka.clients.consumer.ConsumerRecord;
22-
import org.apache.kafka.clients.consumer.ConsumerRecords;
23-
import org.apache.kafka.clients.consumer.GroupProtocol;
24-
import org.apache.kafka.clients.consumer.KafkaConsumer;
17+
package org.apache.kafka.clients.consumer;
18+
2519
import org.apache.kafka.clients.consumer.internals.AbstractHeartbeatRequestManager;
2620
import org.apache.kafka.clients.producer.ProducerConfig;
2721
import org.apache.kafka.clients.producer.ProducerRecord;

core/src/test/java/kafka/test/api/CustomQuotaCallbackTest.java renamed to clients/clients-integration-tests/src/test/java/org/apache/kafka/server/quota/CustomQuotaCallbackTest.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package kafka.test.api;
17+
package org.apache.kafka.server.quota;
1818

1919
import org.apache.kafka.clients.admin.Admin;
2020
import org.apache.kafka.clients.admin.NewTopic;
@@ -28,9 +28,6 @@
2828
import org.apache.kafka.common.test.api.Type;
2929
import org.apache.kafka.common.test.junit.ClusterTestExtensions;
3030
import org.apache.kafka.server.config.QuotaConfig;
31-
import org.apache.kafka.server.quota.ClientQuotaCallback;
32-
import org.apache.kafka.server.quota.ClientQuotaEntity;
33-
import org.apache.kafka.server.quota.ClientQuotaType;
3431

3532
import org.junit.jupiter.api.extension.ExtendWith;
3633

@@ -42,9 +39,9 @@
4239
@ClusterTestDefaults(controllers = 3,
4340
types = {Type.KRAFT},
4441
serverProperties = {
45-
@ClusterConfigProperty(id = 3000, key = QuotaConfig.CLIENT_QUOTA_CALLBACK_CLASS_CONFIG, value = "kafka.test.api.CustomQuotaCallbackTest$CustomQuotaCallback"),
46-
@ClusterConfigProperty(id = 3001, key = QuotaConfig.CLIENT_QUOTA_CALLBACK_CLASS_CONFIG, value = "kafka.test.api.CustomQuotaCallbackTest$CustomQuotaCallback"),
47-
@ClusterConfigProperty(id = 3002, key = QuotaConfig.CLIENT_QUOTA_CALLBACK_CLASS_CONFIG, value = "kafka.test.api.CustomQuotaCallbackTest$CustomQuotaCallback"),
42+
@ClusterConfigProperty(id = 3000, key = QuotaConfig.CLIENT_QUOTA_CALLBACK_CLASS_CONFIG, value = "org.apache.kafka.server.quota.CustomQuotaCallbackTest$CustomQuotaCallback"),
43+
@ClusterConfigProperty(id = 3001, key = QuotaConfig.CLIENT_QUOTA_CALLBACK_CLASS_CONFIG, value = "org.apache.kafka.server.quota.CustomQuotaCallbackTest$CustomQuotaCallback"),
44+
@ClusterConfigProperty(id = 3002, key = QuotaConfig.CLIENT_QUOTA_CALLBACK_CLASS_CONFIG, value = "org.apache.kafka.server.quota.CustomQuotaCallbackTest$CustomQuotaCallback"),
4845
}
4946
)
5047
@ExtendWith(ClusterTestExtensions.class)

core/src/test/java/kafka/server/BootstrapControllersIntegrationTest.java renamed to server/src/test/java/org/apache/kafka/server/BootstrapControllersIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package kafka.server;
18+
package org.apache.kafka.server;
1919

2020
import org.apache.kafka.clients.admin.Admin;
2121
import org.apache.kafka.clients.admin.AlterConfigOp;

core/src/test/java/kafka/server/LogManagerIntegrationTest.java renamed to server/src/test/java/org/apache/kafka/server/LogManagerIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package kafka.server;
17+
package org.apache.kafka.server;
1818

1919
import org.apache.kafka.clients.admin.Admin;
2020
import org.apache.kafka.clients.admin.NewTopic;

0 commit comments

Comments
 (0)