-
Notifications
You must be signed in to change notification settings - Fork 138
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
Integration specs #5
Comments
Hi Harry, Is there any docs or even just a basic example on how to do this. Really trying to test my consumers but unsure best approach. I use Sidekiq as well and there is a Sidekiq::Testing.fake! Is there anything similar or a pattern I can follow to get some solid testing going? Cheers, Luke |
@lukebyrne no. It's straightforward to connect and publish messages but consumer and config loading may need additional public API methods for convenience. I'm not sure "fake" implementations count for integration testing, by the way. Having RabbitMQ running locally is not hard. |
@michaelklishin got any suggestions of how to spin up a hutch consumer from a spec_helper.rb Here is a gist of a consumer and a consumer_spec I have written up. Just not sure how I would actually get the test suite to spin up a Hutch like so
to flush the message through. I have RabbitMQ running locally and all my dev stuff works great, just need/want some tests around it for peace of mind and refactoring process. |
@lukebyrne I pushed some stuff to master that makes it possible to run Hutch using arbitrary require "hutch/cli"
cli = Hutch::CLI.new
cli.run(command-line-args) Give this a try and let us know what else may be missing. |
Hi Michael, I was able to use that command to good effect. You can see how I did it here in this gist. What are your thoughts? Reasonable approach? Bad? https://gist.github.com/lukebyrne/3a068fb04e744c623a15 I will be deploying my app to Heroku, on the consumers side I am able to connect to the 3rd party service using the .yml configs. Was wondering how would I also set the producer to send messages to this 3rd party service?? Can I pass in vars to Hutch.connect? Maybe like so
Any help appreciated, really enjoying this library. Thank you. |
It's an OK approach, one little suggestion: I'd use |
Cool thanks for the feedback. I am picking through the Gem code to try and suss out how I would connect to 3rd party RabbitMQ Cloud provied when I want to publish my messages. What should the
Any directions and suggestions would be much appreciated, will still continue to pick through the code, and docs, trial and error for now. Cheers, Luke |
Hi Michael, I have sussed it out.
|
Write some integration specs that test the whole process of receiving a message from RabbitMQ, and taking action in a consumer.
The text was updated successfully, but these errors were encountered: