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

pubsub: turn PublishResult into an interface, or make it mockable #7801

Closed
dmathieu opened this issue Apr 20, 2023 · 1 comment
Closed

pubsub: turn PublishResult into an interface, or make it mockable #7801

dmathieu opened this issue Apr 20, 2023 · 1 comment
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@dmathieu
Copy link

Is your feature request related to a problem? Please describe.

The exposed PublishResult is available publicly, but can't be manipulated manually, as everything behind it is within an internal package.

While not being able to publish results ourselves makes sense at runtime, it makes writing unit tests quite harder, as we can't mock call our handlers with specific results.

Describe the solution you'd like

I would like to be able to create PublishResult structs, and mark them as ready, give them an error and a custom server name.

Describe alternatives you've considered

Not having this is kind of preventing writing any unit tests for things that rely on PublishResult, so the only alternative is not having tests.

Additional context

N/A at this stage.

@dmathieu dmathieu added the triage me I really want to be triaged. label Apr 20, 2023
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Apr 20, 2023
@noahdietz noahdietz added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels May 23, 2023
@hongalex
Copy link
Member

We're currently not interested in doing this. There's some history to why PublishResult is private, and if you're interested, the discussion is in #3200

I would suggest using the fake with the AddPublishResponse method as an alternative.

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. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants