rails / activejob

Declare job classes that can be run by a variety of queueing backends
743 stars 47 forks source link

Integration testing #102

Closed cristianbica closed 10 years ago

cristianbica commented 10 years ago

Created the basics to run the tests and implemented the delayed_jobs tests. The ways testing works is you schedule jobs, you ask the adapter to run the jobs and them make assertions. My first try was to start an actual adapter worker process but it's gets complicated and it will increase greatly the runtime. This is still WIP and I'll add more adapters as I find time and solutions to run the jobs (delayed_jobs is easier as it supports this built-in .. the work_off).

cristianbica commented 10 years ago

I'll update the .travis.yml once we have the integration tests for all adapters

cristianbica commented 10 years ago

@mperham I'm trying to get the sidekiq integration testing working but I don't have the time to dig into the sidekiq's internals. Can you help me with some sample code that will get any jobs from the queue and run them? thanks

mperham commented 10 years ago

There's no documented way to boot Sidekiq manually. NewRelic has some code here which they use for Sidekiq integration testing:

https://github.com/newrelic/rpm/blob/04640bb21110aa43503140bb7ef99a2587bbd84f/test/multiverse/suites/sidekiq/sidekiq_server.rb

cristianbica commented 10 years ago

Thanks. I'll take a look. The aproach I used for these tests is to schedule jobs and then ask the adapter to run any pending jobs without forking or running any separate processes. Not sure it's the best way but I found some bugs :)

cristianbica commented 10 years ago

Extracted(#103) the fixes for some bugs found during developing this and I'm going to rewrite the integration testing. Too much black magic to run the jobs in the testing thread. I'll rewrite this to start a worker process for the adapter when the test starts and kill the worker when the tests finishes

cristianbica commented 10 years ago

Seems that we have an integration test suite that it's working :) cc @dhh

dhh commented 10 years ago

Awesome!