Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <noreply@github.com>
  • Loading branch information
lowlighter authored Jan 18, 2022
1 parent 28ff369 commit ec5daf8
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/failing/verbose_output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ testcases:
script: echo foo
assertions:
- result.systemout ShouldEqual foo
- name: Test named step
steps:
- name: hello-world
type: exec
script: echo foo
assertions:
- result.systemout ShouldEqual foo
- name: Test multi step
steps:
- type: exec
- name: step1
type: exec
script: echo foo
assertions:
- result.systemout ShouldEqual foo
- type: exec
- name: step2
type: exec
script: echo bar
assertions:
- result.systemout ShouldEqual foo
Expand All @@ -32,11 +41,14 @@ testcases:
v: foo
- name: Test must assertions
steps:
- type: exec
- name: must1
type: exec
script: echo foo
assertions:
- result.systemout MustEqual bar
- type: exec
- name: must2
type: exec
script: echo foo
- type: exec
- name: must3
type: exec
script: echo bar
35 changes: 35 additions & 0 deletions tests/verbose_output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: testsuite run in verbose mode
testcases:
- name: testsuite run in verbose mode
steps:
# spawn a venom sub-process and expect it to fail and make assertions on its error messages
# ensure no color to avoid annoying checks
- type: exec
script: NO_COLOR=1 {{.venom.executable}} run failing/verbose_output.yml {{.value.opt}}
range:
verbose:
opt: "-v"
op: Should
default:
opt: ""
op: ShouldNot
assertions:
- result.code ShouldEqual 2
- result.systemerr ShouldBeEmpty
# single step
- result.systemout {{.value.op}}ContainSubstring 'exec SUCCESS'
# named step
- result.systemout {{.value.op}}ContainSubstring 'hello-world SUCCESS'
# multi steps
- result.systemout {{.value.op}}ContainSubstring 'step1 SUCCESS'
- result.systemout {{.value.op}}ContainSubstring 'step2 FAILURE'
# ranged steps
- result.systemout {{.value.op}}ContainSubstring 'exec (range=0) SUCCESS'
- result.systemout {{.value.op}}ContainSubstring 'exec (range=1) FAILURE'
- result.systemout {{.value.op}}ContainSubstring 'exec (range=2) SUCCESS'
# must assertions
- result.systemout {{.value.op}}ContainSubstring 'must1 FAILURE'
- result.systemout ShouldContainSubstring 'At least one required assertion failed, skipping remaining steps'
- result.systemout {{.value.op}}ContainSubstring '2 other steps were skipped'
- result.systemout ShouldNotContainSubstring 'must2'
- result.systemout ShouldNotContainSubstring 'must3'

0 comments on commit ec5daf8

Please sign in to comment.