jolshan commented on a change in pull request #11459:
URL: https://github.com/apache/kafka/pull/11459#discussion_r750452864



##########
File path: 
core/src/test/scala/integration/kafka/server/FetchRequestTestDowngrade.scala
##########
@@ -0,0 +1,85 @@
+/**
+ * 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 integration.kafka.server
+
+import java.time.Duration
+import java.util.Arrays.asList
+
+import kafka.api.{ApiVersion, KAFKA_2_7_IV0, KAFKA_3_1_IV0}
+import kafka.server.{BaseRequestTest, KafkaConfig}
+import kafka.utils.TestUtils
+import kafka.zk.ZkVersion
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.common.TopicPartition
+import org.junit.jupiter.api.Assertions._
+import org.junit.jupiter.api.Test
+
+import scala.collection.{Map, Seq}
+
+class FetchRequestTestDowngrade extends BaseRequestTest {
+
+    override def brokerCount: Int = 3
+    override def generateConfigs: Seq[KafkaConfig] = {
+        // Brokers should start with newer IBP and downgrade to the older one.
+        Seq(
+                createConfig(0, KAFKA_3_1_IV0),
+                createConfig(1, KAFKA_3_1_IV0),
+                createConfig(2, KAFKA_2_7_IV0)
+        )
+    }
+
+    @Test
+    def testTopicIdsInFetcherOldController(): Unit = {
+        val topic = "topic"
+        val producer = createProducer()
+        val consumer = createConsumer()
+
+        ensureControllerIn(Seq(0))
+        assertEquals(0, controllerSocketServer.config.brokerId)
+        val partitionLeaders = createTopic(topic,  Map(0 -> Seq(1, 0, 2), 1 -> 
Seq(0, 2, 1)))

Review comment:
       We can just have one, but I think originally I was testing with each 
broker as a leader. I guess we only need it so that the old IBP is the leader.




-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to