Skip to content

Commit 7a1ca67

Browse files
committed
Fix input snapshotting error when using test clusters cliSetup (#52340)
1 parent ad01f07 commit 7a1ca67

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

buildSrc/src/main/java/org/elasticsearch/gradle/LazyPropertyList.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,23 @@ public List<T> subList(int fromIndex, int toIndex) {
170170
}
171171

172172
@Override
173-
public List<? extends Object> getNormalizedCollection() {
173+
public List<? extends PropertyListEntry<T>> getNormalizedCollection() {
174174
return delegate.stream()
175175
.peek(this::validate)
176176
.filter(entry -> entry.getNormalization() != PropertyNormalization.IGNORE_VALUE)
177177
.collect(Collectors.toList());
178178
}
179179

180+
/**
181+
* Return a "flattened" collection. This should be used when the collection type is itself a complex type with properties
182+
* annotated as Gradle inputs rather than a simple type like {@link String}.
183+
*
184+
* @return a flattened collection filtered according to normalization strategy
185+
*/
186+
public List<? extends T> getFlatNormalizedCollection() {
187+
return getNormalizedCollection().stream().map(PropertyListEntry::getValue).collect(Collectors.toList());
188+
}
189+
180190
private void validate(PropertyListEntry<T> entry) {
181191
assertNotNull(entry.getValue(), "entry");
182192
}

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ public List<?> getKeystoreFiles() {
11881188

11891189
@Nested
11901190
public List<?> getCliSetup() {
1191-
return cliSetup.getNormalizedCollection();
1191+
return cliSetup.getFlatNormalizedCollection();
11921192
}
11931193

11941194
@Nested

0 commit comments

Comments
 (0)