Skip to content

improve context support #716

@pohly

Description

@pohly

When a context is canceled, context.Cause may be able to provide a better explanation that just "context canceled" (the error returned by Context.Err). This can be useful to figure out which timeout triggered, in particular when Ginkgo also supports it (onsi/ginkgo#1326).

fail("Context was cancelled")
could check for a cause and include that explanation. Bonus points for avoiding "Context was cancelled because context canceled" 😁

When a Gomega async assertion has its own timeout and the callback function accepts a context, create a context that contains that timeout and pass that to the callback. Right now, the context given to gomega.Eventually is passed through (

inValues = append(inValues, reflect.ValueOf(assertion.ctx))
), so if the callback blocks, it doesn't time out as requested via a per-assertion timeout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions