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

call t.Error() from sub-tests not Scenario.Run() #10

Merged
merged 1 commit into from
Aug 8, 2023
Merged

Commits on Aug 8, 2023

  1. 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 <jaypipes@gmail.com>
    jaypipes committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    eea5de6 View commit details
    Browse the repository at this point in the history