Skip to content

chore: update testutil chan helpers #17408

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

Merged
merged 2 commits into from
Apr 16, 2025
Merged

chore: update testutil chan helpers #17408

merged 2 commits into from
Apr 16, 2025

Conversation

aslilac
Copy link
Member

@aslilac aslilac commented Apr 15, 2025

  • Rename RequireRecvCtx to TryReceive
  • Rename RequireSendCtx to RequireSend
  • Remove unused AssertSendCtx
  • Add RequireReceive function that will fail the test if the chan is closed

These new names more clearly describe their functionality.

  • The primary purpose of these helpers doesn't actually center around contexts, and mostly uses them as a way to cancel the channel read if the test times out.
  • RequireRecvCtx as it was implemented didn't actually require that you could read a value from the chan. It would just return a zero value if the chan was closed.
  • The new RequireReceive properly requires that a value is received from the chan.

@brettkolodny
Copy link
Contributor

Initially a scary amount of changes but looks good to me!

@aslilac aslilac merged commit f670bc3 into main Apr 16, 2025
34 checks passed
@aslilac aslilac deleted the lilac/testutil-chan branch April 16, 2025 16:37
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants