[go: nahoru, domu]

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/pstest: add TopicID field to the Message struct #10439

Open
adzil opened this issue Jun 26, 2024 · 3 comments
Open

pubsub/pstest: add TopicID field to the Message struct #10439

adzil opened this issue Jun 26, 2024 · 3 comments
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

@adzil
Copy link
adzil commented Jun 26, 2024

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

Right now there is no way to identify the topic id of a pstest.Message that returned from calling pstest.Server.Messages method.

Describe the solution you'd like

Create a new TopicID field in pstest.Message and ensure that it gets populated when a client is publishing to the fake server.

Describe alternatives you've considered

None, I believe the first solution is pretty straightforward and quite trivial to implement.

Additional context

I can help contribute to this feature request on approval.

@adzil adzil added the triage me I really want to be triaged. label Jun 26, 2024
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Jun 26, 2024
@hongalex
Copy link
Member

Could you elaborate a bit more on why this might be helpful for you from a testing perspective?

@hongalex hongalex 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 Jun 26, 2024
@adzil
Copy link
Author
adzil commented Jun 27, 2024

Sure! I'm currently writing a package that can automatically route to multiple Pub/Sub topics. In the unit test, I will need to check whether the package routes (or in this case publishes) to the correct topic or not.

Right now, because of there's no topic ID information in the Message, I need to manually create a subscription for each topic. Then, I will need to consume each one of the subscription and join them back again with a topic ID information added. I believe that these type of tests can be greatly simplified if I can just look into the topic information directly on the published messages.

@hongalex
Copy link
Member

Yeah that seems fine to me. If you create a PR for this, I'll be happy to review and help get it merged in.

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

2 participants