mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Quick fix for nested Templates that were breaking --list-workloads
This commit is contained in:
parent
52e9a1a14f
commit
eb1adcff5e
@ -0,0 +1,4 @@
|
|||||||
|
min_version: "5.21.0"
|
||||||
|
|
||||||
|
description: |
|
||||||
|
TBD, similar to find_one_and_delete.yaml
|
@ -6,4 +6,4 @@ blocks:
|
|||||||
list_collection_names:
|
list_collection_names:
|
||||||
ops:
|
ops:
|
||||||
op1:
|
op1:
|
||||||
list_collection_names:
|
list_collection_names: "TEMPLATE(collection1)"
|
||||||
|
@ -6,4 +6,4 @@ blocks:
|
|||||||
list_collections:
|
list_collections:
|
||||||
ops:
|
ops:
|
||||||
op1:
|
op1:
|
||||||
list_collections:
|
list_collections: "TEMPLATE(collection1)"
|
||||||
|
@ -140,7 +140,7 @@ public class RawOpDef extends RawOpFields {
|
|||||||
if (v == null) {
|
if (v == null) {
|
||||||
throw new OpConfigError("A map key '" + k.toString() + "' with a null value was encountered. This is not" +
|
throw new OpConfigError("A map key '" + k.toString() + "' with a null value was encountered. This is not" +
|
||||||
" allowed, and may be the result of using an unquoted binding, like {" + k + "}. You can simply wrap this in quotes" +
|
" allowed, and may be the result of using an unquoted binding, like {" + k + "}. You can simply wrap this in quotes" +
|
||||||
" like \"{"+ k +"\"} to avoid interpreting this as a JSON map." +
|
" like \"{"+ k +"}\" to avoid interpreting this as a JSON map." +
|
||||||
(path.size()>0 ? String.join(".",path):""));
|
(path.size()>0 ? String.join(".",path):""));
|
||||||
} else {
|
} else {
|
||||||
if (v instanceof Map) {
|
if (v instanceof Map) {
|
||||||
|
@ -313,7 +313,7 @@ public class NBCLIScenarioPreprocessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern templatePattern = Pattern.compile("TEMPLATE\\((.+?)\\)");
|
private static final Pattern templatePattern = Pattern.compile("TEMPLATE\\((.+?)\\)");
|
||||||
private static final Pattern innerTemplatePattern = Pattern.compile("TEMPLATE\\((.+?)$");
|
private static final Pattern innerTemplatePattern = Pattern.compile("TEMPLATE\\((.+?)\\)");
|
||||||
private static final Pattern templatePattern2 = Pattern.compile("<<(.+?)>>");
|
private static final Pattern templatePattern2 = Pattern.compile("<<(.+?)>>");
|
||||||
|
|
||||||
public static List<WorkloadDesc> filterForScenarios(List<Content<?>> candidates) {
|
public static List<WorkloadDesc> filterForScenarios(List<Content<?>> candidates) {
|
||||||
@ -444,22 +444,18 @@ public class NBCLIScenarioPreprocessor {
|
|||||||
String match = matcher.group(1);
|
String match = matcher.group(1);
|
||||||
|
|
||||||
Matcher innerMatcher = innerTemplatePattern.matcher(match);
|
Matcher innerMatcher = innerTemplatePattern.matcher(match);
|
||||||
String[] matchArray = match.split("[,:]");
|
|
||||||
if (matchArray.length==1) {
|
|
||||||
matchArray = new String[]{matchArray[0],""};
|
|
||||||
}
|
|
||||||
// if (matchArray.length!=2) {
|
|
||||||
// throw new BasicError("TEMPLATE form must have two arguments separated by a comma, like 'TEMPLATE(a,b), not '" + match +"'");
|
|
||||||
// }
|
|
||||||
//TODO: support recursive matches
|
|
||||||
if (innerMatcher.find()) {
|
if (innerMatcher.find()) {
|
||||||
String[] innerMatch = innerMatcher.group(1).split("[,:]");
|
String innerMatch = innerMatcher.group(1);
|
||||||
|
templates = matchTemplates("TEMPLATE(" + innerMatch + ")", templates);
|
||||||
//We want the outer name with the inner default value
|
String resolvedInner = templates.getOrDefault(innerMatch.split("[,:]")[0], "");
|
||||||
templates.put(matchArray[0], innerMatch[1]);
|
match = match.replace("TEMPLATE(" + innerMatch + ")", resolvedInner);
|
||||||
} else {
|
|
||||||
templates.put(matchArray[0], matchArray[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String[] matchArray = match.split("[,:]");
|
||||||
|
if (matchArray.length == 1) {
|
||||||
|
matchArray = new String[]{matchArray[0], ""};
|
||||||
|
}
|
||||||
|
templates.put(matchArray[0], matchArray[1]);
|
||||||
}
|
}
|
||||||
matcher = templatePattern2.matcher(line);
|
matcher = templatePattern2.matcher(line);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user