Block use of current version feature in yaml tests (#112737)
Using the current version as a condition is not compatible with Serverless, as the version doesn't change between commits. Cluster features should be used instead.
This commit is contained in:
parent
0ab2afb395
commit
0bed668a7d
|
@ -95,6 +95,27 @@ class ESRestTestFeatureService implements TestFeatureService {
|
|||
Matcher matcher = VERSION_FEATURE_PATTERN.matcher(featureId);
|
||||
if (matcher.matches()) {
|
||||
Version extractedVersion = Version.fromString(matcher.group(1));
|
||||
if (extractedVersion.after(Version.CURRENT)) {
|
||||
throw new IllegalArgumentException(
|
||||
Strings.format(
|
||||
"Cannot use a synthetic feature [%s] for a version after the current version [%s]",
|
||||
featureId,
|
||||
Version.CURRENT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (extractedVersion.equals(Version.CURRENT)) {
|
||||
throw new IllegalArgumentException(
|
||||
Strings.format(
|
||||
"Cannot use a synthetic feature [%s] for the current version [%s]; "
|
||||
+ "please define a test cluster feature alongside the corresponding code change instead",
|
||||
featureId,
|
||||
Version.CURRENT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return checkCollection(nodeVersions, v -> v.onOrAfter(extractedVersion), any);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue