Skip to content

Commit

Permalink
Include test features in feature name generation (elastic#116078)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop committed Nov 1, 2024
1 parent f022a53 commit bcf920f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.stream.Stream;

public class HistoricalFeaturesMetadataExtractor {
private final ClassLoader classLoader;
Expand Down Expand Up @@ -92,7 +93,9 @@ void extractHistoricalFeatureMetadata(CheckedBiConsumer<Map<NodeFeature, Version
ServiceLoader<FeatureSpecification> featureSpecLoader = ServiceLoader.load(FeatureSpecification.class, classLoader);
for (FeatureSpecification featureSpecification : featureSpecLoader) {
historicalFeatures.putAll(featureSpecification.getHistoricalFeatures());
featureSpecification.getFeatures().stream().map(NodeFeature::id).forEach(featureNames::add);
Stream.concat(featureSpecification.getFeatures().stream(), featureSpecification.getTestFeatures().stream())
.map(NodeFeature::id)
.forEach(featureNames::add);
}
metadataConsumer.accept(historicalFeatures, featureNames);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.not;

Expand All @@ -48,6 +49,7 @@ public void testExtractHistoricalMetadata() throws IOException {
});
assertThat(nodeFeatureVersionMap, not(anEmptyMap()));
assertThat(featureNamesSet, not(empty()));
assertThat(featureNamesSet, hasItem("test_features_enabled"));

Path outputFile = temporaryFolder.newFile().toPath();
extractor.generateMetadataFile(outputFile);
Expand Down

0 comments on commit bcf920f

Please sign in to comment.