-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QT-696] Add enos scenario outline
#128
Conversation
Add metadata support to Enos scenarios to allow us to quickly read an outline of a scenario and determine what quality characteristics are verified. We introduce new DSL schema: - `quality`: A new top-level object that describes a quality characteristic. - `quality.description`: An required string attribute in the `quality` block that describes the quality characteristic in detail. - `scenario.description`: An optional string attribute that describes the scenario. - `scenario.step.description`: An optional string attribute that describes the scenario step. - `scenario.step.verifies`: An optional `quality` attribute. Can be either a singular `quality` or a list of `quality`'s. Using these new blocks and attributes a scenario author can now more fully describe the purpose of the scenario, each step, and which quality characteristics are verified by it. To see the generated outline you can use `enos scenario outline <optional-filter>` to generate a scenario outline. The `scenario outline` sub-command supports a new output formatter: `html`. Use the HTML formatter and your browser for a cleaner overview if so desired, e.g.: ``` enos scenario outline --format html > outline.html open outline.html ``` * Fix deprecations in `.golangci.yml` * Fix warnings output by `golangci-lint` * Silence `buf` lint error that is irrelevant to us * Support decoding `quality` blocks * Support decoding `scenario.description` * Support decoding `scenario.step.description` * Support decoding `scenario.verifies` * Add `OutlineScenario()` RPC to the enos service. * Add acceptance test for `enos scenario outline` * Restructure matrix decoder into its own type. This allows us to keep a copy of the original matrix around to use in the outline * Add new decoder target for scenario outlines * Add `ShowOutline()` to `basic` UI * Add `ShowOutline()` to `machine` UI * Create a shim HTML UI * Add `ShowOutline()` to `html` UI * Bump version to 0.0.28 * Add missing documenation for `globals` DSL to `README.md` * Add missing documenation for `sample` DSL to `README.md` * Add documenation for `quality` DSL to `README.md` * Add missing documenation for `enos scenario sample` command to `README.md` * Add documenation for `enos scenario outline` command to `README.md` Signed-off-by: Ryan Cragun <[email protected]>
eMatrix := NewMatrix() | ||
eAttrs, moreDiags := mBlock.Body.JustAttributes() | ||
diags = diags.Extend(moreDiags) | ||
if moreDiags != nil && moreDiags.HasErrors() { | ||
continue | ||
} | ||
|
||
for _, attr := range md.sortAttributes(eAttrs) { | ||
vec, moreDiags := md.decodeMatrixAttribute(ctx, mBlock, attr) | ||
diags = diags.Extend(moreDiags) | ||
if moreDiags != nil && moreDiags.HasErrors() { | ||
continue | ||
} | ||
eMatrix.AddVector(vec) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this code appears to be verbatim of the include case. Wonder if this could be shared logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored all matrix attribute decoding into a function which we now use at both top level keys and in include
and exclude
blocks.
return v.ShowError(err) | ||
} | ||
|
||
v.basic.UI().Output(buf.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt this will happen but UI()
can return a nil pointer and this could panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have nil guards on the access so it should be safe. I added a test case to check anyway.
Signed-off-by: Ryan Cragun <[email protected]>
Signed-off-by: Ryan Cragun <[email protected]>
Signed-off-by: Ryan Cragun <[email protected]>
Signed-off-by: Ryan Cragun <[email protected]>
Signed-off-by: Ryan Cragun <[email protected]>
Signed-off-by: Ryan Cragun <[email protected]>
Add metadata support to Enos scenarios to allow us to quickly read an outline of a scenario and determine what quality characteristics are verified.
We introduce new DSL schema:
quality
: A new top-level object that describes a quality characteristic.quality.description
: An required string attribute in thequality
block that describes the quality characteristic in detail.scenario.description
: An optional string attribute that describes the scenario.scenario.step.description
: An optional string attribute that describes the scenario step.scenario.step.verifies
: An optionalquality
attribute. Can be either a singularquality
or a list ofquality
's.Using these new blocks and attributes a scenario author can now more fully describe the purpose of the scenario, each step, and which quality characteristics are verified by it.
To see the generated outline you can use
enos scenario outline <optional-filter>
to generate a scenario outline.The
scenario outline
sub-command supports a new output formatter:html
. Use the HTML formatter and your browser for a cleaner overview if so desired, e.g.:.golangci.yml
golangci-lint
buf
lint error that is irrelevant to usquality
blocksscenario.description
scenario.step.description
scenario.verifies
OutlineScenario()
RPC to the enos service.enos scenario outline
ShowOutline()
tobasic
UIShowOutline()
tomachine
UIShowOutline()
tohtml
UIglobals
DSL toREADME.md
sample
DSL toREADME.md
quality
DSL toREADME.md
enos scenario sample
command toREADME.md
enos scenario outline
command toREADME.md
Checklist