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

test(pubsub): make error checking of receive less brittle #10165

Merged
merged 5 commits into from
May 14, 2024

Conversation

hongalex
Copy link
Member

Receive can occasionally return context.Canceled. This makes tests that call Receive less brittle by checking explicitly for canceled. This also replaces checks of the codes.Canceled status code.

@hongalex hongalex requested review from shollyman and a team as code owners May 14, 2024 01:05
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label May 14, 2024
Copy link
Contributor

@shollyman shollyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, these all seem like a good case for a swap to errors.Is(err, context.Cancelled) rather than a direct equality check.

Copy link
Contributor

@shollyman shollyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving based on discussed refactoring

@hongalex hongalex merged commit 7371665 into googleapis:main May 14, 2024
8 checks passed
@hongalex hongalex deleted the test-pubsub-receive-cancel branch May 14, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants