dajac commented on code in PR #17013: URL: https://github.com/apache/kafka/pull/17013#discussion_r1734649526
########## core/src/test/java/kafka/test/junit/RaftClusterInvocationContext.java: ########## @@ -246,21 +247,48 @@ public Map<Integer, ControllerServer> controllers() { public void format() throws Exception { if (formated.compareAndSet(false, true)) { - List<ApiMessageAndVersion> records = new ArrayList<>(); - records.add( - new ApiMessageAndVersion(new FeatureLevelRecord(). - setName(MetadataVersion.FEATURE_NAME). - setFeatureLevel(clusterConfig.metadataVersion().featureLevel()), (short) 0)); - - clusterConfig.features().forEach((feature, version) -> { - records.add( - new ApiMessageAndVersion(new FeatureLevelRecord(). - setName(feature.featureName()). - setFeatureLevel(version), (short) 0)); + Map<String, Features> nameToSupportedFeature = new TreeMap<>(); + Features.PRODUCTION_FEATURES.forEach(feature -> nameToSupportedFeature.put(feature.featureName(), feature)); + Map<String, Short> newFeatureLevels = new TreeMap<>(); + + // Verify that all specified features are known to us. + for (Map.Entry<Features, Short> entry : clusterConfig.features().entrySet()) { + String featureName = entry.getKey().featureName(); + short level = entry.getValue(); + if (!featureName.equals(MetadataVersion.FEATURE_NAME)) { + if (!nameToSupportedFeature.containsKey(featureName)) { + throw new FormatterException("Unsupported feature: " + featureName + Review Comment: Updated. -- 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