add new interface for testing

This commit is contained in:
Cody Lee
2022-12-22 17:44:39 -06:00
parent a5f858c23a
commit db9bcd5687
11 changed files with 201 additions and 6 deletions

View File

@@ -69,6 +69,19 @@ func (p *plugin) Enabled() bool {
return !p.Disable
}
func (p *plugin) DebugOutput(l poller.Logger) (bool, error) {
if p == nil {
return true, nil
}
if !p.Enabled() {
return true, nil
}
if err := p.validateConfig(); err != nil {
return false, err
}
return true, nil
}
// Run gets called by poller core code. Return when the plugin stops working or has an error.
// In other words, don't run your code in a go routine, it already is.
func (p *plugin) Run(c poller.Collect) error {