squah-confluent commented on code in PR #23732: URL: https://github.com/apache/kafka/pull/23732#discussion_r4240009498
########## group-coordinator/src/test/java/org/apache/kafka/coordinator/group/assignor/uniform2/GroupModelTest.java: ########## @@ -0,0 +1,310 @@ +/* + * 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. + */ +package org.apache.kafka.coordinator.group.assignor.uniform2; + +import org.apache.kafka.common.Uuid; +import org.apache.kafka.coordinator.common.runtime.CoordinatorMetadataImage; +import org.apache.kafka.coordinator.common.runtime.MetadataImageBuilder; +import org.apache.kafka.coordinator.group.api.assignor.SubscribedTopicDescriber; +import org.apache.kafka.coordinator.group.api.assignor.SubscriptionType; +import org.apache.kafka.coordinator.group.modern.SubscribedTopicDescriberImpl; +import org.apache.kafka.coordinator.group.modern.TopicIds; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.IntStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests of {@link GroupModel}: the numbering of the members and the topics, and the cohorts. + * + * <p>The topic ids sort as T1 < T2 < T3, so that when all of them are subscribed T1 is + * topic 0, T2 is topic 1 and T3 is topic 2; the member ids sort as A < B < C < D, so + * that A is member 0, B is member 1, and so on. The members are put in the specs in another + * order, and the subscriptions list their topics in another order, so that the numbers cannot + * come from the iteration order of the spec. + */ +public class GroupModelTest { Review Comment: These tests look random and disorganized. How about: 1. Member numbering tests: `testMembersAreNumberedInMemberIdOrder` 2. Topic numbering tests: `testTopicsAreNumberedInTopicIdOrder`, `testTopicIndex`, `testTopicsThatDoNotExistAreIgnored` (please massage the names and test bodies so they are structured the same) 3. Scenarios for cohorts: `testEmptyGroup`, `testSingleMember`, `testHomogeneousGroup`, `testCohort` (please massage the names and test bodies so they are structured the same) and I couldn't figure out what `testSubscriptionsAsTopicIds` is for. ########## group-coordinator/src/test/java/org/apache/kafka/coordinator/group/assignor/uniform2/GroupModelTest.java: ########## @@ -0,0 +1,310 @@ +/* + * 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. + */ +package org.apache.kafka.coordinator.group.assignor.uniform2; + +import org.apache.kafka.common.Uuid; +import org.apache.kafka.coordinator.common.runtime.CoordinatorMetadataImage; +import org.apache.kafka.coordinator.common.runtime.MetadataImageBuilder; +import org.apache.kafka.coordinator.group.api.assignor.SubscribedTopicDescriber; +import org.apache.kafka.coordinator.group.api.assignor.SubscriptionType; +import org.apache.kafka.coordinator.group.modern.SubscribedTopicDescriberImpl; +import org.apache.kafka.coordinator.group.modern.TopicIds; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.IntStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests of {@link GroupModel}: the numbering of the members and the topics, and the cohorts. + * + * <p>The topic ids sort as T1 < T2 < T3, so that when all of them are subscribed T1 is + * topic 0, T2 is topic 1 and T3 is topic 2; the member ids sort as A < B < C < D, so + * that A is member 0, B is member 1, and so on. The members are put in the specs in another + * order, and the subscriptions list their topics in another order, so that the numbers cannot + * come from the iteration order of the spec. + */ +public class GroupModelTest { Review Comment: These tests look random and disorganized. How about: 1. Member numbering tests: `testMembersAreNumberedInMemberIdOrder` 2. Topic numbering tests: `testTopicsAreNumberedInTopicIdOrder`, `testTopicIndex`, `testTopicsThatDoNotExistAreIgnored` (please massage the names and test bodies so they are structured the same way) 3. Scenarios for cohorts: `testEmptyGroup`, `testSingleMember`, `testHomogeneousGroup`, `testCohort` (please massage the names and test bodies so they are structured the same way) and I couldn't figure out what `testSubscriptionsAsTopicIds` is for. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
