Skip to content

Commit 546fe41

Browse files
committed
Randomize one or none features
1 parent 1f66829 commit 546fe41

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/src/test/java/org/elasticsearch/cluster/ClusterStateIT.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,16 @@ public String getWriteableName() {
155155
return TYPE;
156156
}
157157

158+
/*
159+
* This custom should always be returned yet we randomize whether it has a required feature that the client is expected to have
160+
* versus not requiring any feature. We use a field to make the random choice exactly once.
161+
*/
162+
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
163+
private final Optional<String> requiredFeature = randomBoolean() ? Optional.empty() : Optional.of("node-and-transport-client");
164+
158165
@Override
159166
public Optional<String> getRequiredFeature() {
160-
return Optional.of("node-and-transport-client");
167+
return requiredFeature;
161168
}
162169

163170
}

0 commit comments

Comments
 (0)