Skip to content

Conversation

@jaypipes
Copy link
Member

@jaypipes jaypipes commented Aug 8, 2023

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

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 <jaypipes@gmail.com>
@jaypipes jaypipes merged commit 0d8a00e into main Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants