-
Notifications
You must be signed in to change notification settings - Fork 67
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
Checks should use libraries to minimize duplication of code #65
Comments
I have started to write tests here: https://github.com/rthouvenin/sensu-plugins-rabbitmq/tree/refactor |
And in the same branch I've started the refactor: master...rthouvenin:refactor Now before I continue, I'd be keen on having feedback on whether this is in the right direction. I am not a ruby programmer and this is fairly abstract code, so I may not know the idioms for that kind of tasks. Also, I doubt I will have the time to refactor+test all other checks, and I believe we should refactor only what's tested. Moreover I don't use the other checks so someone who actually uses them might be able to better spot missed use cases. |
@rthouvenin took a quick look and it so far looks fairly reasonable, the one bit of feedback is to split out the different classes and modules to separate files to make it easier to navigate. Regarding the testing and looping in others we should have someone else also review but I am of the stance that if you got something good going it's best to get that incremental change rather than wait for someone to donate some massive amount of effort. Makes sense we do run an external rabbitmq cluster as our sensu transport so we can probably help with some testing even if we are not currently using all the checks. |
Alright thanks. I have separated the module and classes in separate files, and I am starting a PR that can be review / tested in more details. |
perfect I will try to take a look tonight. |
* Add plugin stub for tests * Add tests for queue metrics * Add tests for exchange metrics * Add tests for queue check * Add base class for metrics (#65) * Add common check class * Move common options into a module * Common rabbitmq_info getter * Fix Rubocop offenses * Split module and classes in separate files * Update Changelog * Remove require_relative * Use ruby_dig for older rubies
Currently there is a lot of copy/paste code between checks (and metrics) let's move as much as we can into library modules. The most obvious example is connection logic.
The text was updated successfully, but these errors were encountered: