better uniform spec tests and examples

This commit is contained in:
Jonathan Shook
2021-12-20 10:04:10 -06:00
parent 8b1ac5b574
commit 5aa940cbb7
4 changed files with 233 additions and 11 deletions

View File

@@ -0,0 +1,189 @@
# Op Templates Variations
These examples are here to illustrate and test specific variations of op templates.
## keyed name statement form
*yaml:*
```yaml
ops:
op1:
name: special-op-name
op: select * from ks1.tb1;
params:
prepared: false
```
*json:*
```json5
{
"ops": {
"op1": {
"name": "special-op-name",
"op": "select * from ks1.tb1;",
"params": {
"prepared": false
}
}
}
}
```
*ops:*
```json5
[
{
"name": "block0--special-op-name",
"op": {
"stmt": "select * from ks1.tb1;"
},
"params": {
"prepared": false
},
"tags": {
"block": "block0",
"name": "block0--special-op-name"
}
}
]
```
## keyed name statement-map form with name field
*yaml:*
```yaml
ops:
op1:
name: special-op-name
op:
field1: select * from ks1.tb1;
field2: field 2 value
```
*json:*
```json5
{
"ops": {
"op1": {
"name": "special-op-name",
"op": {
"field1": "select * from ks1.tb1;",
"field2": "field 2 value"
}
}
}
}
```
*ops:*
```json5
[
{
"name": "block0--special-op-name",
"op": {
"field1": "select * from ks1.tb1;",
"field2": "field 2 value"
},
"tags": {
"block": "block0",
"name": "block0--special-op-name"
}
}
]
```
## keyed name statement-map form WITHOUT name field WITH op key
*yaml:*
```yaml
ops:
op1:
op:
field1: select * from ks1.tb1;
field2: field 2 value
```
*json:*
```json5
{
"ops": {
"op1": {
"op": {
"field1": "select * from ks1.tb1;",
"field2": "field 2 value"
}
}
}
}
```
*ops:*
```json5
[
{
"name": "block0--op1",
"op": {
"field1": "select * from ks1.tb1;",
"field2": "field 2 value"
},
"tags": {
"block": "block0",
"name": "block0--op1"
}
}
]
```
## keyed name statement-map form WITHOUT name field WITHOUT op key
*yaml:*
```yaml
ops:
op1:
field1: select * from ks1.tb1;
field2: field 2 value
```
*json:*
```json5
{
"ops": {
"op1": {
"field1": "select * from ks1.tb1;",
"field2": "field 2 value"
}
}
}
```
*ops:*
```json5
[
{
"name": "block0--op1",
"op": {
"stmt": "select * from ks1.tb1;"
},
"params": {
"field1": "select * from ks1.tb1;",
"field2": "field 2 value"
},
"tags": {
"block": "block0",
"name": "block0--op1"
}
}
]
```

View File

@@ -274,7 +274,7 @@ ops:
tags:
phase: schema
params:
prepated: false
prepared: false
description: This is just an example operation
```
@@ -291,7 +291,7 @@ ops:
"name": "special-op-name",
"op": "select * from ks1.tb1;",
"params": {
"prepated": false
"prepared": false
},
"tags": {
"phase": "schema"

View File

@@ -56,7 +56,7 @@ intervening content:
# some yaml here
```
*json*
*json:*
```
[]
@@ -204,6 +204,38 @@ should only be changeable for some steps.
*yaml:*
```yaml
# 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
```
*json:*
```json5
{
"scenarios": {
"default": "run alias==first driver=diag cycles=10"
}
}
```
*ops:*
```json5
[]
```
### verbose locked step parameters
For scenario steps which should not be overridable by user parameters on the command line, a triple
equals is used to indicate that changing these parameters is not allowed. If a user tries to
override a verbose locked parameter, an error is thrown and the scenario is not allowed to run. This
can be useful when you want to clearly indicate that a parameter must remain as it is.
*yaml:*
```yaml
# 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.
@@ -227,14 +259,6 @@ scenarios:
[]
```
### verbose locked step parameters
For scenario steps which should not be overridable by user parameters on the command line, a triple
equals is used to indicate that changing these parameters is not allowed. If a user tries to
override a verbose locked parameter, an error is thrown and the scenario is not allowed to run. This
can be useful when you want to clearly indicate that a parameter must remain as it is.
---
## Bindings

View File

@@ -74,6 +74,15 @@ public class UniformWorkloadSpecificationTest {
);
}
@Test
public void testTemplatedOperationVariations() {
testSpecPath(
NBIO.fs().prefix("target/classes/workload_definition/")
.name("templated_operation_variations.md")
.one().asPath()
);
}
@Test
public void testTemplateVariables() {
testSpecPath(