fix tests to follow API updates

This commit is contained in:
Jonathan Shook 2021-08-10 13:12:15 -05:00
parent 5b41f978c7
commit ef650c769f
6 changed files with 351 additions and 337 deletions

View File

@ -58,11 +58,6 @@ public abstract class Cqld4Op implements CycleOp<ResultSet>, VariableCapture, Op
this.metrics = metrics;
}
@Override
public void accept(long cycle) {
}
public final ResultSet apply(long cycle) {
metrics.onStart();
@ -70,8 +65,6 @@ public abstract class Cqld4Op implements CycleOp<ResultSet>, VariableCapture, Op
rs = session.execute(stmt);
processors.start(cycle, rs);
int totalRows=0;

View File

@ -52,7 +52,8 @@ op: select * from bar.table;
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--stmt1"
"name": "block0--stmt1",
"block": "block0"
}
}
]
@ -87,7 +88,8 @@ ops:
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--stmt1"
"name": "block0--stmt1",
"block": "block0"
}
}
]
@ -127,7 +129,8 @@ ops:
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
"name": "block0--op1",
"block": "block0"
}
}
]
@ -166,7 +169,8 @@ ops:
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
"name": "block0--op1",
"block": "block0"
}
}
]
@ -201,7 +205,8 @@ ops:
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
"name": "block0--op1",
"block": "block0"
}
}
]
@ -239,7 +244,8 @@ ops:
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
"name": "block0--op1",
"block": "block0"
}
}
]
@ -313,7 +319,8 @@ ops:
},
"tags": {
"phase": "schema",
"name": "block0--special-op-name"
"name": "block0--special-op-name",
"block": "block0"
}
}
]
@ -410,7 +417,8 @@ blocks:
"tags": {
"phase": "schema",
"docleveltag": "is-tagging-everything",
"name": "block-named-fred--special-op-name"
"name": "block-named-fred--special-op-name",
"block": "block-named-fred"
}
}
]

View File

@ -392,7 +392,8 @@ blocks:
"stmt": "select * from bar.table;"
},
"tags": {
"name": "namedblock1--op1"
"name": "namedblock1--op1",
"block": "namedblock1"
}
},
{
@ -404,7 +405,8 @@ blocks:
"type": "batch"
},
"tags": {
"name": "namedblock1--op2"
"name": "namedblock1--op2",
"block": "namedblock1"
}
}
]
@ -463,7 +465,8 @@ blocks:
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block1--op1"
"name": "block1--op1",
"block": "block1"
}
},
{
@ -475,7 +478,8 @@ blocks:
"type": "batch"
},
"tags": {
"name": "block1--op2"
"name": "block1--op2",
"block": "block1"
}
},
{
@ -484,7 +488,8 @@ blocks:
"stmt": "select * from foo.table;"
},
"tags": {
"name": "this-is-block-2--op3"
"name": "this-is-block-2--op3",
"block": "this-is-block-2"
}
}
]
@ -530,7 +535,8 @@ blocks:
"stmt": "test op"
},
"tags": {
"name": "myblock--stmt1"
"name": "myblock--stmt1",
"block": "myblock"
}
}
]

View File

@ -18,11 +18,12 @@
package io.nosqlbench.engine.api.activityconfig.yaml;
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
@ -47,7 +48,7 @@ public class StmtDetailOverrideTest {
assertThat(s.getStmt()).contains("globalstatement1");
assertThat(s.getBindings()).hasSize(1);
assertThat(s.getParams()).hasSize(1);
assertThat(s.getTags()).hasSize(2);
assertThat(s.getTags()).isEqualTo(Map.of("block","block0","global_tag1","tag value","name","block0--stmt1"));
StmtsBlock doc1block1 = doc1.getBlocks().get(1);
List<OpTemplate> stmts = doc1block1.getOps();
@ -56,14 +57,14 @@ public class StmtDetailOverrideTest {
s = stmts.get(0);
assertThat(s.getName()).isEqualTo("testblock1--stmt1");
assertThat(s.getStmt()).contains("astatement1");
assertThat(s.getTags()).hasSize(2);
assertThat(s.getTags()).isEqualTo(Map.of("block","testblock1","global_tag1","tag value","name","testblock1--stmt1"));
assertThat(s.getBindings()).hasSize(1);
assertThat(s.getParams()).hasSize(1);
s = stmts.get(1);
assertThat(s.getName()).isEqualTo("testblock1--s2name");
assertThat(s.getStmt()).contains("s2statement data");
assertThat(s.getTags()).hasSize(2);
assertThat(s.getTags()).isEqualTo(Map.of("block","testblock1","global_tag1","tag value","name","testblock1--s2name"));
assertThat(s.getBindings()).hasSize(1);
assertThat(s.getParams()).hasSize(1);
@ -78,7 +79,7 @@ public class StmtDetailOverrideTest {
s = stmts.get(3);
assertThat(s.getName()).isEqualTo("testblock1--s4");
assertThat(s.getStmt()).contains("statement 4");
assertThat(s.getTags()).hasSize(2);
assertThat(s.getTags()).isEqualTo(Map.of("block","testblock1","global_tag1","tag value","name","testblock1--s4"));
assertThat(s.getBindings()).hasSize(1);
assertThat(s.getParams()).hasSize(1);

View File

@ -87,11 +87,11 @@ public class StmtsDocListTest {
assertThat(stmts1.get(0).getBindings()).containsExactly(MapEntry.entry("b2","b2d"),MapEntry.entry("b1","b1d"));
assertThat(stmts1.get(0).getParams()).containsExactly(MapEntry.entry("param1","value1"));
assertThat(stmts1.get(0).getTags()).containsExactly(MapEntry.entry("atagname","atagvalue"),MapEntry.entry("name","doc1--block0--stmt1"));
assertThat(stmts1.get(0).getTags()).isEqualTo(Map.of("atagname","atagvalue","name","doc1--block0--stmt1","block","doc1--block0"));
assertThat(stmts1.get(1).getBindings()).containsExactly(MapEntry.entry("b2","b2d"),MapEntry.entry("b1","b1d"));
assertThat(stmts1.get(1).getParams()).containsExactly(MapEntry.entry("param1","value1"));
assertThat(stmts1.get(1).getTags()).containsExactly(MapEntry.entry("atagname","atagvalue"),MapEntry.entry("name","doc1--block0--stmt2"));
assertThat(stmts1.get(1).getTags()).isEqualTo(Map.of("atagname","atagvalue","name","doc1--block0--stmt2","block","doc1--block0"));
}

View File

@ -5,6 +5,7 @@ import io.nosqlbench.nb.api.errors.BasicError;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@ -92,7 +93,12 @@ public class NBCLIScenarioParserTest {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "scenario-test", "schema-only", "cycles-test=20"});
List<Cmd> cmds = opts.getCommands();
assertThat(cmds.size()).isEqualTo(1);
assertThat(cmds.get(0).getArg("cycles-test")).isEqualTo("20");
assertThat(cmds.get(0).getParams()).isEqualTo(Map.of(
"alias","scenariotest_schemaonly_000",
"driver","stdout",
"tags","phase:schema",
"workload","scenario-test"
));
NBCLIOptions opts1 = new NBCLIOptions(new String[]{ "scenario-test", "schema-only", "doundef=20"});
List<Cmd> cmds1 = opts1.getCommands();
assertThat(cmds1.size()).isEqualTo(1);