Commit eea5de6
committed
call t.Error() from sub-tests not Scenario.Run()
This patch addresses a couple related problems, all with the evaluation
of testing.T failures. When `testing.T.Run()` is executed, a new
goroutine is spawned with a new `testing.T` pointer. This specific
goroutine's `testing.T` pointer needs to have *its* `testing.T.Error()`
method called in order for that sub-test to be marked failed. We were
erroneously calling `testing.T.Error()` within the `Scenario.Run()`
method instead of inside the `Spec.Eval()` method, which resulted in the
test scenario being marked failed instead of the individual test unit.
We address the exec plugin's `Spec.Eval()` in this patch to call
`testing.T.Error()` on any assertion failure however additional patches
are coming for the http and kube plugins.
Finally, I made a change to the `gdterrors.TimeoutExceeded()` function
to allow for an assertion failure message to be supplied to the error
producer, making it easier for folks to see "this test assertion failed
to succeed before a timeout of (duration)".
Addresses Issue #8
Signed-off-by: Jay Pipes <[email protected]>1 parent e14a1af commit eea5de6
3 files changed
+17
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
76 | 81 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 95 | | |
104 | 96 | | |
105 | 97 | | |
| |||
0 commit comments