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

@ -38,7 +38,7 @@ op: select * from bar.table;
```json5
{
"op": "select * from bar.table;"
"op": "select * from bar.table;"
}
```
@ -46,15 +46,16 @@ op: select * from bar.table;
```json5
[
{
"name": "block0--stmt1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--stmt1"
}
{
"name": "block0--stmt1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--stmt1",
"block": "block0"
}
}
]
```
@ -64,16 +65,16 @@ op: select * from bar.table;
```yaml
ops:
- select * from bar.table;
- select * from bar.table;
```
*json:*
```json5
{
"ops": [
"select * from bar.table;"
]
"ops": [
"select * from bar.table;"
]
}
```
@ -81,15 +82,16 @@ ops:
```json5
[
{
"name": "block0--stmt1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--stmt1"
}
{
"name": "block0--stmt1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--stmt1",
"block": "block0"
}
}
]
```
@ -102,18 +104,18 @@ template.
```yaml
ops:
- op1: select * from bar.table;
- op1: select * from bar.table;
```
*json:*
```json5
{
"ops": [
{
"op1": "select * from bar.table;"
}
]
"ops": [
{
"op1": "select * from bar.table;"
}
]
}
```
@ -121,15 +123,16 @@ ops:
```json5
[
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
}
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1",
"block": "block0"
}
}
]
```
@ -139,20 +142,20 @@ ops:
```yaml
ops:
- name: op1
op: select * from bar.table;
- name: op1
op: select * from bar.table;
```
*json:*
```json5
{
"ops": [
{
"name": "op1",
"op": "select * from bar.table;"
}
]
"ops": [
{
"name": "op1",
"op": "select * from bar.table;"
}
]
}
```
@ -160,15 +163,16 @@ ops:
```json5
[
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
}
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1",
"block": "block0"
}
}
]
```
@ -178,16 +182,16 @@ ops:
```yaml
ops:
op1: select * from bar.table;
op1: select * from bar.table;
```
*json:*
```json5
{
"ops": {
"op1": "select * from bar.table;"
}
"ops": {
"op1": "select * from bar.table;"
}
}
```
@ -195,15 +199,16 @@ ops:
```json5
[
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
}
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1",
"block": "block0"
}
}
]
```
@ -213,19 +218,19 @@ ops:
```yaml
ops:
op1:
stmt: select * from bar.table;
op1:
stmt: select * from bar.table;
```
*json:*
```json5
{
"ops": {
"op1": {
"stmt": "select * from bar.table;"
}
"ops": {
"op1": {
"stmt": "select * from bar.table;"
}
}
}
```
@ -233,15 +238,16 @@ ops:
```json5
[
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1"
}
{
"name": "block0--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block0--op1",
"block": "block0"
}
}
]
```
@ -260,38 +266,38 @@ this at work.
```yaml
ops:
op1:
name: special-op-name
op: select * from ks1.tb1;
bindings:
binding1: NumberNameToString();
tags:
phase: schema
params:
prepated: false
description: This is just an example operation
op1:
name: special-op-name
op: select * from ks1.tb1;
bindings:
binding1: NumberNameToString();
tags:
phase: schema
params:
prepated: false
description: This is just an example operation
```
*json:*
```json5
{
"ops": {
"op1": {
"bindings": {
"binding1": "NumberNameToString();"
},
"description": "This is just an example operation",
"name": "special-op-name",
"op": "select * from ks1.tb1;",
"params": {
"prepated": false
},
"tags": {
"phase": "schema"
}
}
"ops": {
"op1": {
"bindings": {
"binding1": "NumberNameToString();"
},
"description": "This is just an example operation",
"name": "special-op-name",
"op": "select * from ks1.tb1;",
"params": {
"prepated": false
},
"tags": {
"phase": "schema"
}
}
}
}
```
@ -299,23 +305,24 @@ ops:
```json5
[
{
"bindings": {
"binding1": "NumberNameToString();"
},
"description": "This is just an example operation",
"name": "block0--special-op-name",
"op": {
"stmt": "select * from ks1.tb1;"
},
"params": {
"prepated": false
},
"tags": {
"phase": "schema",
"name": "block0--special-op-name"
}
{
"bindings": {
"binding1": "NumberNameToString();"
},
"description": "This is just an example operation",
"name": "block0--special-op-name",
"op": {
"stmt": "select * from ks1.tb1;"
},
"params": {
"prepated": false
},
"tags": {
"phase": "schema",
"name": "block0--special-op-name",
"block": "block0"
}
}
]
```
@ -332,27 +339,27 @@ inner-most scope decides the value seen at the op level.
```yaml
tags:
docleveltag: is-tagging-everything # applies to all operations in this case
docleveltag: is-tagging-everything # applies to all operations in this case
bindings:
binding1: Identity(); # will be overridden at the block level
binding1: Identity(); # will be overridden at the block level
params:
prepared: true # set prepared true by default for all contained op templates
prepared: true # set prepared true by default for all contained op templates
blocks:
block-named-fred:
bindings:
binding1: NumberNameToString();
tags:
phase: schema
params:
prepared: false
description: This is just an example operation
ops:
op1:
name: special-op-name
op: select * from ks1.tb1;
block-named-fred:
bindings:
binding1: NumberNameToString();
tags:
phase: schema
params:
prepared: false
description: This is just an example operation
ops:
op1:
name: special-op-name
op: select * from ks1.tb1;
```
@ -360,35 +367,35 @@ blocks:
```json5
{
"tags": {
"docleveltag": "is-tagging-everything"
},
"bindings": {
"binding1": "Identity();"
},
"params": {
"prepared": true
},
"blocks": {
"block-named-fred": {
"bindings": {
"binding1": "NumberNameToString();"
},
"description": "This is just an example operation",
"params": {
"prepared": false
},
"tags": {
"phase": "schema"
},
"ops": {
"op1": {
"name": "special-op-name",
"op": "select * from ks1.tb1;"
}
}
"tags": {
"docleveltag": "is-tagging-everything"
},
"bindings": {
"binding1": "Identity();"
},
"params": {
"prepared": true
},
"blocks": {
"block-named-fred": {
"bindings": {
"binding1": "NumberNameToString();"
},
"description": "This is just an example operation",
"params": {
"prepared": false
},
"tags": {
"phase": "schema"
},
"ops": {
"op1": {
"name": "special-op-name",
"op": "select * from ks1.tb1;"
}
}
}
}
}
```
@ -396,23 +403,24 @@ blocks:
```json5
[
{
"bindings": {
"binding1": "NumberNameToString();"
},
"name": "block-named-fred--special-op-name",
"op": {
"stmt": "select * from ks1.tb1;"
},
"params": {
"prepared": false
},
"tags": {
"phase": "schema",
"docleveltag": "is-tagging-everything",
"name": "block-named-fred--special-op-name"
}
{
"bindings": {
"binding1": "NumberNameToString();"
},
"name": "block-named-fred--special-op-name",
"op": {
"stmt": "select * from ks1.tb1;"
},
"params": {
"prepared": false
},
"tags": {
"phase": "schema",
"docleveltag": "is-tagging-everything",
"name": "block-named-fred--special-op-name",
"block": "block-named-fred"
}
}
]
```

View File

@ -81,15 +81,15 @@ Otherwise, the whole value is used.
```yaml
description: |
summary of this workload
and more details
summary of this workload
and more details
```
*json:*
```json5
{
"description": "summary of this workload\nand more details\n"
"description": "summary of this workload\nand more details\n"
}
```
@ -116,16 +116,16 @@ We're focused merely on the structural rules here.
```yaml
scenarios:
default: run driver=diag cycles=10
default: run driver=diag cycles=10
```
*json:*
```json5
{
"scenarios": {
"default": "run driver=diag cycles=10"
}
"scenarios": {
"default": "run driver=diag cycles=10"
}
}
```
@ -141,21 +141,21 @@ scenarios:
```yaml
scenarios:
default:
step1: run alias=first driver=diag cycles=10
step2: run alias=second driver=diag cycles=10
default:
step1: run alias=first driver=diag cycles=10
step2: run alias=second driver=diag cycles=10
```
*json:*
```json5
{
"scenarios": {
"default": {
"step1": "run alias=first driver=diag cycles=10",
"step2": "run alias=second driver=diag cycles=10"
}
"scenarios": {
"default": {
"step1": "run alias=first driver=diag cycles=10",
"step2": "run alias=second driver=diag cycles=10"
}
}
}
```
@ -171,21 +171,21 @@ scenarios:
```yaml
scenarios:
default:
- run alias=first driver=diag cycles=10
- run alias=second driver=diag cycles=10
default:
- run alias=first driver=diag cycles=10
- run alias=second driver=diag cycles=10
```
*json:*
```json5
{
"scenarios": {
"default": [
"run alias=first driver=diag cycles=10",
"run alias=second driver=diag cycles=10"
]
}
"scenarios": {
"default": [
"run alias=first driver=diag cycles=10",
"run alias=second driver=diag cycles=10"
]
}
}
```
@ -208,16 +208,16 @@ should only be changeable for some steps.
# The user is not allowed to change the value for the alias parameter, and attempting to do so
# will cause an error to be thrown and the scenario halted.
scenarios:
default: run alias===first driver=diag cycles=10
default: run alias===first driver=diag cycles=10
```
*json:*
```json5
{
"scenarios": {
"default": "run alias===first driver=diag cycles=10"
}
"scenarios": {
"default": "run alias===first driver=diag cycles=10"
}
}
```
@ -248,18 +248,18 @@ which are just function chains from the provided libraries.
```yaml
bindings:
cycle: Identity();
name: NumberNameToString();
cycle: Identity();
name: NumberNameToString();
```
*json:*
```json5
{
"bindings": {
"cycle": "Identity();",
"name": "NumberNameToString();"
}
"bindings": {
"cycle": "Identity();",
"name": "NumberNameToString();"
}
}
```
@ -282,18 +282,18 @@ operation's command or payload, like consistency level, or timeout settings.
```yaml
params:
param1: pvalue1
param2: pvalue2
param1: pvalue1
param2: pvalue2
```
*json:*
```json5
{
"params": {
"param1": "pvalue1",
"param2": "pvalue2"
}
"params": {
"param1": "pvalue1",
"param2": "pvalue2"
}
}
```
@ -317,16 +317,16 @@ in the workload construction guide.
```yaml
tags:
phase: main
phase: main
```
*json:*
```json5
{
"tags": {
"phase": "main"
}
"tags": {
"phase": "main"
}
}
```
@ -356,29 +356,29 @@ can be specified.
```yaml
blocks:
namedblock1:
ops:
op1: select * from bar.table;
op2:
type: batch
stmt: insert into bar.table (a,b,c) values (1,2,3);
namedblock1:
ops:
op1: select * from bar.table;
op2:
type: batch
stmt: insert into bar.table (a,b,c) values (1,2,3);
```
*json:*
```json5
{
"blocks": {
"namedblock1": {
"ops": {
"op1": "select * from bar.table;",
"op2": {
"type": "batch",
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
}
}
"blocks": {
"namedblock1": {
"ops": {
"op1": "select * from bar.table;",
"op2": {
"type": "batch",
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
}
}
}
}
}
```
@ -386,27 +386,29 @@ blocks:
```json5
[
{
"name": "namedblock1--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "namedblock1--op1"
}
{
"name": "namedblock1--op1",
"op": {
"stmt": "select * from bar.table;"
},
{
"name": "namedblock1--op2",
"op": {
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
},
"params": {
"type": "batch"
},
"tags": {
"name": "namedblock1--op2"
}
"tags": {
"name": "namedblock1--op1",
"block": "namedblock1"
}
},
{
"name": "namedblock1--op2",
"op": {
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
},
"params": {
"type": "batch"
},
"tags": {
"name": "namedblock1--op2",
"block": "namedblock1"
}
}
]
```
@ -418,14 +420,14 @@ When blocks are defined as a list of entries, each entry is a map.
```yaml
blocks:
- ops:
op1: select * from bar.table;
op2:
type: batch
stmt: insert into bar.table (a,b,c) values (1,2,3);
- name: this-is-block-2
ops:
op3: select * from foo.table;
- ops:
op1: select * from bar.table;
op2:
type: batch
stmt: insert into bar.table (a,b,c) values (1,2,3);
- name: this-is-block-2
ops:
op3: select * from foo.table;
```
@ -433,23 +435,23 @@ blocks:
```json5
{
"blocks": [
{
"ops": {
"op1": "select * from bar.table;",
"op2": {
"type": "batch",
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
}
}
},
{
"name": "this-is-block-2",
"ops": {
"op3": "select * from foo.table;"
}
"blocks": [
{
"ops": {
"op1": "select * from bar.table;",
"op2": {
"type": "batch",
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
}
]
}
},
{
"name": "this-is-block-2",
"ops": {
"op3": "select * from foo.table;"
}
}
]
}
```
@ -457,36 +459,39 @@ blocks:
```json5
[
{
"name": "block1--op1",
"op": {
"stmt": "select * from bar.table;"
},
"tags": {
"name": "block1--op1"
}
{
"name": "block1--op1",
"op": {
"stmt": "select * from bar.table;"
},
{
"name": "block1--op2",
"op": {
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
},
"params": {
"type": "batch"
},
"tags": {
"name": "block1--op2"
}
},
{
"name": "this-is-block-2--op3",
"op": {
"stmt": "select * from foo.table;"
},
"tags": {
"name": "this-is-block-2--op3"
}
"tags": {
"name": "block1--op1",
"block": "block1"
}
},
{
"name": "block1--op2",
"op": {
"stmt": "insert into bar.table (a,b,c) values (1,2,3);"
},
"params": {
"type": "batch"
},
"tags": {
"name": "block1--op2",
"block": "block1"
}
},
{
"name": "this-is-block-2--op3",
"op": {
"stmt": "select * from foo.table;"
},
"tags": {
"name": "this-is-block-2--op3",
"block": "this-is-block-2"
}
}
]
```
@ -502,8 +507,8 @@ additional field named `name` can be used.
```yaml
blocks:
- name: myblock
op: "test op"
- name: myblock
op: "test op"
```
@ -511,12 +516,12 @@ blocks:
```json5
{
"blocks": [
{
"name": "myblock",
"op": "test op"
}
]
"blocks": [
{
"name": "myblock",
"op": "test op"
}
]
}
```
@ -524,15 +529,16 @@ blocks:
```json5
[
{
"name": "myblock--stmt1",
"op": {
"stmt": "test op"
},
"tags": {
"name": "myblock--stmt1"
}
{
"name": "myblock--stmt1",
"op": {
"stmt": "test op"
},
"tags": {
"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);