Skip to content

Conversation

@fredbi
Copy link
Member

@fredbi fredbi commented Jan 11, 2026

Change type

Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update

Short description

Fixes

Full description

Checklist

  • I have signed all my commits with my name and email (see DCO. This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change.

Reference (original issue report): stretchr#1611

This fix involves a complete rewrite of assertions that run background
checks, with more idiomatic go routine codes and use of context.Context.

Affected assertions:

* Eventually
* Never
* EventuallyWithT

We no longer run go routines that are not waited for.
Timeouts and early exits are handled via context.Context.

CollecT.FailNow() now also cancels the context of the caller instead.

Significant changes:
* callers should not expect Eventually and others to
  complete in the case of a blocking condition function.
  In particular, the condition function should never wait for an event that is
  triggered after Eventually. Complex or long-running condition function
  may use t.Context() to exit early if the test is failed.
* callers may safely assume that only one go routine is executing the
  condition function (no race on writes)

* test: asserted stretch/testify#480 is fixed

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@codecov
Copy link

codecov bot commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 94.73684% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.72%. Comparing base (c217cc4) to head (73531db).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
internal/assertions/condition.go 94.73% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #30      +/-   ##
==========================================
+ Coverage   88.70%   88.72%   +0.01%     
==========================================
  Files          63       63              
  Lines        8244     8338      +94     
==========================================
+ Hits         7313     7398      +85     
- Misses        768      776       +8     
- Partials      163      164       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fredbi fredbi merged commit 69fcab1 into go-openapi:master Jan 11, 2026
22 of 23 checks passed
@fredbi fredbi deleted the fix/480-1611 branch January 11, 2026 16:49
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.

1 participant