-
Notifications
You must be signed in to change notification settings - Fork 92
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
Any advice on testing worker code that calls: JobCompleteTx #605
Comments
@advdv Presumably you've tried inserting a job, but aren't able to target it because Hmm, we might be missing a helper that allows you to transition a job from from available to running for testing purposes. |
I did not try to insert the job, I ended up going down a unit-testing route. I would image that for more of an integration testing setup it would definitely be usefull to have a "PrepareJobForTesting" helper function. I now use special tag that i can inspect to not call "JobCompleteTx" during testing. Something like this (NOTE that the tx is real though):
For my tests, i setup jobs with a helper like this:
|
I'm very excited about this project, thank you and hats off!
I have work function that calls: JobCompleteTx to atomicaly complete the job as well as perform other work on the tx. It seems that this is pretty hard to unit test right now, the JobCompleteTx can only complete if the job actually exist in the database.
Ofcourse the JobCompleteTx can be mocked/replaced in the tests. Or i could insert actualy jobs, but that is a bit harder to do in my specific case because it's periodic job. Or maybe i'm overlooking something?
The text was updated successfully, but these errors were encountered: