Skip to content
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

Merged
merged 7 commits into from
Apr 9, 2024
Merged

[QT-696] Add enos scenario outline #128

merged 7 commits into from
Apr 9, 2024

Conversation

ryancragun
Copy link
Collaborator

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

Checklist

  • The commit message includes an explanation of the changes
  • Manual validation of the changes have been performed (if possible)
  • New or modified code has requisite test coverage (if possible)
  • I have performed a self-review of the changes
  • I have made necessary changes and/or pull requests for documentation
  • I have written useful comments in the code

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]>
@ryancragun ryancragun added the changelog/feat New feature or enhancement. Will be included in "New Features" category in release notes. label Apr 5, 2024
@ryancragun ryancragun requested a review from a team as a code owner April 5, 2024 21:54
Comment on lines 220 to 234
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)
}

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.

Copy link
Collaborator Author

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())

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.

Copy link
Collaborator Author

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.

@jasonodonnell jasonodonnell self-requested a review April 9, 2024 18:30
@ryancragun ryancragun requested review from a team, marianoasselborn and jeanneryan and removed request for a team April 9, 2024 19:49
@ryancragun ryancragun merged commit d654099 into main Apr 9, 2024
5 checks passed
@ryancragun ryancragun deleted the ryan/qt-696 branch April 9, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/feat New feature or enhancement. Will be included in "New Features" category in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants