Skip to content

Commit f76603a

Browse files
committed
refactor
1 parent 7f4dcb4 commit f76603a

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

core/src/test/scala/unit/kafka/server/KafkaApisTest.scala

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8254,11 +8254,9 @@ class KafkaApisTest extends Logging {
82548254
}
82558255

82568256
@ParameterizedTest
8257-
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH)
8257+
// We only test with topic ids.
8258+
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH, fromVersion = 10)
82588259
def testHandleOffsetFetchWithUnknownTopicIds(version: Short): Unit = {
8259-
// We only test with topic ids.
8260-
if (version < 10) return
8261-
82628260
val foo = "foo"
82638261
val bar = "bar"
82648262
val fooId = Uuid.randomUuid()
@@ -8399,11 +8397,9 @@ class KafkaApisTest extends Logging {
83998397
}
84008398

84018399
@ParameterizedTest
8402-
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH)
8400+
// The single group builder does not support topic ids.
8401+
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH, toVersion = 9)
84038402
def testHandleOffsetFetchWithSingleGroup(version: Short): Unit = {
8404-
// The single group builder does not support topic ids.
8405-
if (version >= 10) return
8406-
84078403
def makeRequest(version: Short): RequestChannel.Request = {
84088404
buildRequest(new OffsetFetchRequest.Builder(
84098405
"group-1",
@@ -8476,12 +8472,10 @@ class KafkaApisTest extends Logging {
84768472
}
84778473

84788474
@ParameterizedTest
8479-
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH)
8475+
// Version 1 does not support fetching all offsets request. We are not
8476+
// interested in testing these here.
8477+
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH, fromVersion = 2)
84808478
def testHandleOffsetFetchAllOffsetsWithSingleGroup(version: Short): Unit = {
8481-
// Version 1 does not support fetching all offsets request. We are not
8482-
// interested in testing these here.
8483-
if (version < 2) return
8484-
84858479
val foo = "foo"
84868480
val fooId = Uuid.randomUuid()
84878481
addTopicToMetadataCache(foo, topicId = fooId, numPartitions = 2)
@@ -8571,11 +8565,9 @@ class KafkaApisTest extends Logging {
85718565
}
85728566

85738567
@ParameterizedTest
8574-
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH)
8568+
// We don't test the non batched API.
8569+
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH, fromVersion = 8)
85758570
def testHandleOffsetFetchAuthorization(version: Short): Unit = {
8576-
// We don't test the non batched API.
8577-
if (version < 8) return
8578-
85798571
val foo = "foo"
85808572
val bar = "bar"
85818573
val fooId = Uuid.randomUuid()
@@ -8767,11 +8759,9 @@ class KafkaApisTest extends Logging {
87678759
}
87688760

87698761
@ParameterizedTest
8770-
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH)
8762+
// We don't test the non batched API.
8763+
@ApiKeyVersionsSource(apiKey = ApiKeys.OFFSET_FETCH, fromVersion = 8)
87718764
def testHandleOffsetFetchWithUnauthorizedTopicAndTopLevelError(version: Short): Unit = {
8772-
// We don't test the non batched API.
8773-
if (version < 8) return
8774-
87758765
val foo = "foo"
87768766
val bar = "bar"
87778767
val fooId = Uuid.randomUuid()

0 commit comments

Comments
 (0)