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

Support for testing around pattern matching in topic to consumer mapping #166

Closed
MatthewRDodds opened this issue Oct 24, 2023 · 3 comments · Fixed by #167
Closed

Support for testing around pattern matching in topic to consumer mapping #166

MatthewRDodds opened this issue Oct 24, 2023 · 3 comments · Fixed by #167
Assignees
Labels
enhancement New feature or request

Comments

@MatthewRDodds
Copy link

Thank you for this library, it's been very helpful for testing my topic to consumer mappings and making sure the correct consumer class is invoked and the correct behavior is found.

I'm switching now to using patterns instead of named topics, specifically for the DLQ case as described in the docs.

In my spec I'm using:

karafka.consumer_for("dlq-demo-topic")

And in my consumer mapping I have:

pattern(:dlqs_pattern, /^dlq.*/) do
  consumer DeadLetterQueueConsumer
end

I've tried a few different variations of the regex, but I always get Karafka::Testing::Errors::TopicNotFoundError when running my tests. As I understand, testing pattern matches like this is not currently supported.

@mensfeld mensfeld self-assigned this Oct 25, 2023
@mensfeld mensfeld added the enhancement New feature or request label Oct 25, 2023
@mensfeld
Copy link
Member

Indeed, it should be supported.

@mensfeld
Copy link
Member

@MatthewRDodds would you mind checking if this PR works for you? #167 it works for me :)

@MatthewRDodds
Copy link
Author

@MatthewRDodds would you mind checking if this PR works for you? #167 it works for me :)

That works 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants