kezhuw commented on a change in pull request #15397:
URL: https://github.com/apache/flink/pull/15397#discussion_r603392842



##########
File path: 
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/source/enumerator/KafkaSourceEnumStateSerializerTest.java
##########
@@ -0,0 +1,100 @@
+/*
+ * 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.flink.connector.kafka.source.enumerator;
+
+import org.apache.flink.connector.base.source.utils.SerdeUtils;
+import org.apache.flink.connector.kafka.source.split.KafkaPartitionSplit;
+import 
org.apache.flink.connector.kafka.source.split.KafkaPartitionSplitSerializer;
+
+import org.apache.kafka.common.TopicPartition;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class KafkaSourceEnumStateSerializerTest {
+
+    private static final int NUM_READERS = 10;
+    private static final String TOPIC_PREFIX = "topic-";
+    private static final int NUM_PARTITIONS = 10;
+    private static final long STARTING_OFFSET = 
KafkaPartitionSplit.EARLIEST_OFFSET;
+
+    @Test
+    public void testBackwardCompatibility() throws IOException {

Review comment:
       Just a personal taste. I recommend following steps:
   * Constructs `KafkaSourceEnumState.assignedSplits`.
   * Distributes that split set to split assignments in deterministic way.
   * Save and restore.
   * Assert. The assertion should be simple `equals`.
   
   Currently, I have to align `constructSplitAssignments` and 
`constructSplitAssignments` manually for assertion evaluation.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to