Lately some of the bugs I’ve been fixing have been difficult to reproduce in a test controller locally, so I’ve been adding wrenches (github.com/juju/juju/wrench) to the code to simulate them. You can see some examples in https://github.com/juju/juju/pull/9691 - wrench.IsActive(“category”, “name”) checks for a file at /var/lib/juju/wrench/category containing name, and then you can return an error or sleep or whatever.
I’m not sure whether I should be leaving them in the code, and I’m wondering what other people think. My reasoning from the comment on the PR was:
I feel like they’re distracting from the actual code flow, and I haven’t been putting tests in for them (since I’m using them as a development tool) which seems a bit risky. Leaving them in commented was a bit of a compromise so a dev wouldn’t have to reinvent the wheel in the future if they want to get into that state, but it’s still clutter.
My initial thinking was to remove them, but that means that my QA steps aren’t repeatable. Is that a problem?
There are a few in the codebase already, but I think they’re ones that are used by tests to hit some particularly tricky error case.
Thoughts?