Skip to content

Commit 07092d7

Browse files
committed
KAFKA-19941: Improved property spacing/readability of kafka-features.sh output
1 parent 0e1c6fb commit 07092d7

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

tools/src/main/java/org/apache/kafka/tools/FeatureCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static void handleDescribe(Admin adminClient) throws ExecutionException, Interru
228228
featureMetadata.supportedFeatures().keySet().stream().sorted().forEach(feature -> {
229229
short finalizedLevel = (featureMetadata.finalizedFeatures().get(feature) == null) ? 0 : featureMetadata.finalizedFeatures().get(feature).maxVersionLevel();
230230
SupportedVersionRange range = featureMetadata.supportedFeatures().get(feature);
231-
System.out.printf("Feature: %s\tSupportedMinVersion: %s\tSupportedMaxVersion: %s\tFinalizedVersionLevel: %s\tEpoch: %s%n",
231+
System.out.printf("Feature: %s\t\tSupportedMinVersion: %s\t\tSupportedMaxVersion: %s\t\tFinalizedVersionLevel: %s\t\tEpoch: %s%n",
232232
feature,
233233
levelToString(feature, range.minVersion()),
234234
levelToString(feature, range.maxVersion()),

tools/src/test/java/org/apache/kafka/tools/FeatureCommandTest.java

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ public void testDescribeWithKRaft(ClusterInstance cluster) {
5353
List<String> features = Arrays.stream(commandOutput.split("\n")).sorted().toList();
5454

5555
// Change expected message to reflect latest MetadataVersion (SupportedMaxVersion increases when adding a new version)
56-
assertEquals("Feature: eligible.leader.replicas.version\tSupportedMinVersion: 0\t" +
57-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(0)));
58-
assertEquals("Feature: group.version\tSupportedMinVersion: 0\t" +
59-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(1)));
60-
assertEquals("Feature: kraft.version\tSupportedMinVersion: 0\t" +
61-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(2)));
62-
assertEquals("Feature: metadata.version\tSupportedMinVersion: 3.3-IV3\t" +
63-
"SupportedMaxVersion: 4.3-IV0\tFinalizedVersionLevel: 3.3-IV3\t", outputWithoutEpoch(features.get(3)));
64-
assertEquals("Feature: share.version\tSupportedMinVersion: 0\t" +
65-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(4)));
66-
assertEquals("Feature: streams.version\tSupportedMinVersion: 0\t" +
67-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(5)));
68-
assertEquals("Feature: transaction.version\tSupportedMinVersion: 0\t" +
69-
"SupportedMaxVersion: 2\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(6)));
56+
assertEquals("Feature: eligible.leader.replicas.version\t\tSupportedMinVersion: 0\t\t" +
57+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(0)));
58+
assertEquals("Feature: group.version\t\tSupportedMinVersion: 0\t\t" +
59+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(1)));
60+
assertEquals("Feature: kraft.version\t\tSupportedMinVersion: 0\t\t" +
61+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(2)));
62+
assertEquals("Feature: metadata.version\t\tSupportedMinVersion: 3.3-IV3\t\t" +
63+
"SupportedMaxVersion: 4.3-IV0\t\tFinalizedVersionLevel: 3.3-IV3\t\t", outputWithoutEpoch(features.get(3)));
64+
assertEquals("Feature: share.version\t\tSupportedMinVersion: 0\t\t" +
65+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(4)));
66+
assertEquals("Feature: streams.version\t\tSupportedMinVersion: 0\t\t" +
67+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(5)));
68+
assertEquals("Feature: transaction.version\t\tSupportedMinVersion: 0\t\t" +
69+
"SupportedMaxVersion: 2\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(6)));
7070
}
7171

7272
// Use the first MetadataVersion that supports KIP-919
@@ -79,20 +79,20 @@ public void testDescribeWithKRaftAndBootstrapControllers(ClusterInstance cluster
7979
List<String> features = Arrays.stream(commandOutput.split("\n")).sorted().toList();
8080

8181
// Change expected message to reflect latest MetadataVersion (SupportedMaxVersion increases when adding a new version)
82-
assertEquals("Feature: eligible.leader.replicas.version\tSupportedMinVersion: 0\t" +
83-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(0)));
84-
assertEquals("Feature: group.version\tSupportedMinVersion: 0\t" +
85-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(1)));
86-
assertEquals("Feature: kraft.version\tSupportedMinVersion: 0\t" +
87-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(2)));
88-
assertEquals("Feature: metadata.version\tSupportedMinVersion: 3.3-IV3\t" +
89-
"SupportedMaxVersion: 4.3-IV0\tFinalizedVersionLevel: 3.7-IV0\t", outputWithoutEpoch(features.get(3)));
90-
assertEquals("Feature: share.version\tSupportedMinVersion: 0\t" +
91-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(4)));
92-
assertEquals("Feature: streams.version\tSupportedMinVersion: 0\t" +
93-
"SupportedMaxVersion: 1\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(5)));
94-
assertEquals("Feature: transaction.version\tSupportedMinVersion: 0\t" +
95-
"SupportedMaxVersion: 2\tFinalizedVersionLevel: 0\t", outputWithoutEpoch(features.get(6)));
82+
assertEquals("Feature: eligible.leader.replicas.version\t\tSupportedMinVersion: 0\t\t" +
83+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(0)));
84+
assertEquals("Feature: group.version\t\tSupportedMinVersion: 0\t\t" +
85+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(1)));
86+
assertEquals("Feature: kraft.version\t\tSupportedMinVersion: 0\t\t" +
87+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(2)));
88+
assertEquals("Feature: metadata.version\t\tSupportedMinVersion: 3.3-IV3\t\t" +
89+
"SupportedMaxVersion: 4.3-IV0\t\tFinalizedVersionLevel: 3.7-IV0\t\t", outputWithoutEpoch(features.get(3)));
90+
assertEquals("Feature: share.version\t\tSupportedMinVersion: 0\t\t" +
91+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(4)));
92+
assertEquals("Feature: streams.version\t\tSupportedMinVersion: 0\t\t" +
93+
"SupportedMaxVersion: 1\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(5)));
94+
assertEquals("Feature: transaction.version\t\tSupportedMinVersion: 0\t\t" +
95+
"SupportedMaxVersion: 2\t\tFinalizedVersionLevel: 0\t\t", outputWithoutEpoch(features.get(6)));
9696
}
9797

9898
@ClusterTest(types = {Type.KRAFT}, metadataVersion = MetadataVersion.IBP_3_3_IV3)
@@ -257,8 +257,8 @@ public void testHandleDescribe() {
257257
throw new RuntimeException(e);
258258
}
259259
});
260-
assertEquals(format("Feature: foo.bar\tSupportedMinVersion: 0\tSupportedMaxVersion: 10\tFinalizedVersionLevel: 5\tEpoch: 123%n" +
261-
"Feature: metadata.version\tSupportedMinVersion: 3.3-IV3\tSupportedMaxVersion: 3.5-IV0\tFinalizedVersionLevel: 3.4-IV0\tEpoch: 123"), describeResult);
260+
assertEquals(format("Feature: foo.bar\t\tSupportedMinVersion: 0\t\tSupportedMaxVersion: 10\t\tFinalizedVersionLevel: 5\t\tEpoch: 123%n" +
261+
"Feature: metadata.version\t\tSupportedMinVersion: 3.3-IV3\t\tSupportedMaxVersion: 3.5-IV0\t\tFinalizedVersionLevel: 3.4-IV0\t\tEpoch: 123"), describeResult);
262262
}
263263

264264
@Test

0 commit comments

Comments
 (0)