How do you test your plugins?

Hi,

as I’ve recently has been given a task to develop a new DCD plugin I was wondering how everyone tests their plugins.

My current approach ist to save plugin-specific logic in separate modules. These modules have no imports of anything CMK. This allows me to create unittests for these moduls that can be run independent of an specific CMK instance.
These unittests are then used as part of a CI/CD pipeline.

How are you testing your plugins?
What tools exist that may help me with testing my CMK plugin?

Oh this is a complex setup.
I do all my plugin (check plugin) development the old way. Create a very rudimentary plugin from my different templates. Then write a parse function if needed. Look to the output with a command like
“cmk --debug --checks=my_new_check --cache -vvI TESTHOST”
As the output from the parse function is processed from the inventory function i can get a result with a simple print statement at the start of the inventory function.
Next step is then the inventory function and at last the check function.
After successful inventory the debug call will only change to
“cmk --debug --checks=my_new_check --cache -vvn TESTHOST”
for testing.

1 Like