test that multiple occurrences of template var resolve consistently

This commit is contained in:
Jonathan Shook 2022-01-19 12:46:49 -06:00
parent 2767da34f0
commit 7ff0920a4b
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package io.nosqlbench.engine.cli;
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class NBCLIScenarioParserTemplateVarTest {
@Test
public void providePathForScenario() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "local/example-scenarios-templatevars" });
List<Cmd> cmds = opts.getCommands();
cmds.forEach(System.out::println);
StmtsDocList workload1 = StatementsLoader.loadPath(null, cmds.get(0).getArg("workload"),cmds.get(0).getParams());
OpTemplate optpl = workload1.getStmts().get(0);
assertThat(optpl.getStmt()).contains("cycle {cycle} replaced replaced\n");
System.out.println("op:"+optpl);
}
}

View File

@ -0,0 +1,10 @@
# example-scenarios.yaml
scenarios:
default:
- run cycles=3 alias=A driver=stdout tvar1=replaced
- run cycles=5 alias=B driver=stdout
bindings:
cycle: Identity()
name: NumberNameToCycle()
statements:
- cycle: "cycle {cycle} TEMPLATE(tvar1,def1) TEMPLATE(tvar1)\n"