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

If there are runbook run failures in runn run, list the failure results at the end (always). #1018

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var runCmd = &cobra.Command{
case "none":
default:
// If --verbose == true, leave it to cmdout to display results
if err := r.Out(os.Stdout, !flgs.Verbose); err != nil {
if err := r.Out(os.Stdout); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions result.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ func (r *runNResult) HasFailure() bool {
return false
}

func (r *runNResult) Out(out io.Writer, verbose bool) error {
func (r *runNResult) Out(out io.Writer) error {
var ts, fs string
_, _ = fmt.Fprintln(out, "")
if verbose && r.HasFailure() {
if r.HasFailure() {
_, _ = fmt.Fprintln(out, "")
i := 1
var err error
Expand Down
13 changes: 6 additions & 7 deletions result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import (
func TestResultOut(t *testing.T) {
noColor(t)
tests := []struct {
r *runNResult
verbose bool
r *runNResult
}{
{newRunNResult(t, 4, []*RunResult{
{
Expand All @@ -37,7 +36,7 @@ func TestResultOut(t *testing.T) {
Path: "testdata/book/runn_3.skip.yml",
Err: nil,
},
}), false},
})},
{newRunNResult(t, 5, []*RunResult{
{
ID: "ab13ba1e546838ceafa17f91ab3220102f397b2e",
Expand All @@ -64,7 +63,7 @@ func TestResultOut(t *testing.T) {
Path: "testdata/book/always_failure.yml",
Err: nil,
},
}), false},
})},
{newRunNResult(t, 2, []*RunResult{
{
ID: "ab13ba1e546838ceafa17f91ab3220102f397b2e",
Expand All @@ -76,7 +75,7 @@ func TestResultOut(t *testing.T) {
Path: "testdata/book/runn_1_fail.yml",
Err: ErrDummy,
},
}), false},
})},
{newRunNResult(t, 2, []*RunResult{
{
ID: "ab13ba1e546838ceafa17f91ab3220102f397b2e",
Expand All @@ -88,13 +87,13 @@ func TestResultOut(t *testing.T) {
Path: "testdata/book/runn_1_fail.yml",
Err: ErrDummy,
},
}), true},
})},
}
for i, tt := range tests {
key := fmt.Sprintf("result_out_%d", i)
t.Run(key, func(t *testing.T) {
buf := new(bytes.Buffer)
if err := tt.r.Out(buf, tt.verbose); err != nil {
if err := tt.r.Out(buf); err != nil {
t.Error(err)
}
got := buf.String()
Expand Down
3 changes: 3 additions & 0 deletions testdata/result_out_0.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@


1) testdata/book/runn_1_fail.yml ab13ba1e546838ceafa17f91ab3220102f397b2e
Failure/Error: dummy

4 scenarios, 0 skipped, 1 failure
3 changes: 3 additions & 0 deletions testdata/result_out_1.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@


1) testdata/book/runn_1_fail.yml ab13ba1e546838ceafa17f91ab3220102f397b2e
Failure/Error: dummy

5 scenarios, 0 skipped, 1 failure
3 changes: 3 additions & 0 deletions testdata/result_out_2.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@


1) testdata/book/runn_1_fail.yml ab13ba1e546838ceafa17f91ab3220102f397b2e
Failure/Error: dummy

2 scenarios, 0 skipped, 1 failure
Loading