Dry run mode #791
Unanswered
olivier-thatch
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be nice if the gem supported a "dry run" mode to test tasks without actually executing side effects.
I used to work at Stripe, which is a large Ruby shop like Shopify but doesn't use Rails, and we had a tool that was very similar to this gem that supported dry run using the following pattern:
Basically, the idea is that any sort of side effects (typically DB writes, but can be anything) are wrapped in
do_something_real
method, and there is ado_something_dry
counterpart method with the same signature but without side effects (typically, outputting a log message with what the real version would have done). Then when running the migration,perform(:method_name, **args)
will call the appropriate version depending on whether dry-run mode is enabled or not.This was very useful to derisk complex or otherwise critical migrations, by allowing you to run the code against production data but without side effects.
Of course this pattern is just one of many ways a dry-run mode could be implemented. I'm opening this discussion mostly to see if there would be an interest in such a feature rather than discuss a particular implementation.
Beta Was this translation helpful? Give feedback.
All reactions