Skip to content

Commit 352ac31

Browse files
committed
print all nodes when skipping
1 parent 5437b45 commit 352ac31

8 files changed

Lines changed: 24 additions & 13 deletions

File tree

commander_linux.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ tests:
66
- ✓ [ssh-host] it should test ssh host
77
- ✓ [ssh-host] it should set env variable
88
- ✓ [ssh-host-default] it should be executed on ssh-host-default
9-
- "- [] it should skip, was skipped"
9+
- "- [ssh-host-default] it should skip, was skipped"
10+
- "- [ssh-host] it should skip, was skipped"
11+
- "- [local] it should skip, was skipped"
1012
- ✓ [ssh-host] it should test multiple hosts
1113
- ✓ [ssh-host-default] it should test multiple hosts
1214
- ✓ [local] it should test multiple hosts

commander_unix.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tests:
1515
stdout:
1616
contains:
1717
- ✓ [local] it should exit with error code
18-
- "- [] it should skip, was skipped"
18+
- "- [local] it should skip, was skipped"
1919
line-count: 17
2020
exit-code: 0
2121

commander_windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tests:
1414
command: commander.exe test ./integration/windows/commander_test.yaml
1515
stdout:
1616
contains:
17-
- "- [] it should skip, was skipped"
17+
- "- [local] it should skip, was skipped"
1818
- test
1919
exit-code: 0
2020

integration/linux/nodes.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ tests:
4444
it should skip:
4545
command: whoami
4646
stdout: root
47+
config:
48+
nodes:
49+
- ssh-host-default
50+
- ssh-host
51+
- local
4752
skip: true
4853

4954
it should test multiple hosts:

pkg/output/cli.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (w *OutputWriter) printResult(r TestResult) {
9191
}
9292

9393
func (w *OutputWriter) printSkip(r TestResult) {
94-
w.fprintf(fmt.Sprintf("- [] %s, was skipped", r.Title))
94+
w.fprintf(fmt.Sprintf("- [%s] %s, was skipped", r.Node, r.Title))
9595
}
9696

9797
func (w *OutputWriter) printFailures(results []runtime.TestResult) {
@@ -101,12 +101,17 @@ func (w *OutputWriter) printFailures(results []runtime.TestResult) {
101101

102102
for _, tr := range results {
103103
r := convertTestResult(tr)
104+
if r.Skipped {
105+
continue
106+
}
107+
104108
if r.Error != nil {
105109
w.fprintf(w.au.Bold(w.au.Red(w.template.errors(r))))
106110
w.fprintf(r.Error.Error())
107111
continue
108112
}
109-
if !r.Success && !r.Skipped {
113+
114+
if !r.Success {
110115
w.fprintf(w.au.Bold(w.au.Red(w.template.failures(r))))
111116
w.fprintf(r.Diff)
112117
}

pkg/output/cli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func Test_EventHandlerTestSkipped(t *testing.T) {
5151
}
5252
}
5353
output := buf.String()
54-
assert.Contains(t, output, "- [] Skipped test, was skipped")
54+
assert.Contains(t, output, "- [192.168.0.1] Skipped test, was skipped")
5555
}
5656

5757
func Test_PrintSummary(t *testing.T) {

pkg/runtime/runner.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ func (r *Runner) Run(tests []TestCase) <-chan TestResult {
3131
defer wg.Done()
3232

3333
for t := range tests {
34-
if t.Skip {
35-
tr := TestResult{TestCase: t, Skipped: true}
36-
out <- tr
37-
continue
38-
}
39-
4034
// If no node was set use local mode as default
4135
if len(t.Nodes) == 0 {
4236
t.Nodes = []string{"local"}
@@ -46,6 +40,11 @@ func (r *Runner) Run(tests []TestCase) <-chan TestResult {
4640
result := TestResult{}
4741
for i := 1; i <= t.Command.GetRetries(); i++ {
4842

43+
if t.Skip {
44+
result = TestResult{TestCase: t, Skipped: true, Node: n}
45+
break
46+
}
47+
4948
e := r.getExecutor(n)
5049
result = e.Execute(t)
5150
result.Node = n

pkg/runtime/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func (r *Runtime) Start(tests []TestCase) Result {
138138
if tr.Skipped {
139139
result.Skipped++
140140

141-
log.Println("title: '"+tr.TestCase.Title+"'", " Was skipped")
141+
log.Println("title: '"+tr.TestCase.Title+"'", " was skipped")
142142
log.Println("title: '"+tr.TestCase.Title+"'", " Command: ", tr.TestCase.Command.Cmd)
143143
log.Println("title: '"+tr.TestCase.Title+"'", " Directory: ", tr.TestCase.Command.Dir)
144144
log.Println("title: '"+tr.TestCase.Title+"'", " Env: ", tr.TestCase.Command.Env)

0 commit comments

Comments
 (0)