2016-01-07 20:39:43 +00:00
|
|
|
package inputs
|
2015-04-01 16:34:32 +00:00
|
|
|
|
2016-01-27 21:21:36 +00:00
|
|
|
import (
|
|
|
|
"github.com/influxdata/telegraf"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
|
|
)
|
2015-04-01 16:34:32 +00:00
|
|
|
|
2016-08-08 22:06:03 +00:00
|
|
|
// MockPlugin struct should be named the same as the Plugin
|
2015-04-01 16:34:32 +00:00
|
|
|
type MockPlugin struct {
|
|
|
|
mock.Mock
|
|
|
|
}
|
|
|
|
|
2016-08-08 22:06:03 +00:00
|
|
|
// Description will appear directly above the plugin definition in the config file
|
|
|
|
func (m *MockPlugin) Description() string {
|
|
|
|
return `This is an example plugin`
|
|
|
|
}
|
|
|
|
|
|
|
|
// SampleConfig will populate the sample configuration portion of the plugin's configuration
|
|
|
|
func (m *MockPlugin) SampleConfig() string {
|
|
|
|
return ` sampleVar = 'foo'`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Gather defines what data the plugin will gather.
|
2016-01-27 21:21:36 +00:00
|
|
|
func (m *MockPlugin) Gather(_a0 telegraf.Accumulator) error {
|
2015-04-06 16:32:10 +00:00
|
|
|
ret := m.Called(_a0)
|
2015-04-01 16:34:32 +00:00
|
|
|
|
2015-04-06 16:32:10 +00:00
|
|
|
r0 := ret.Error(0)
|
2015-04-01 16:34:32 +00:00
|
|
|
|
2015-04-06 16:32:10 +00:00
|
|
|
return r0
|
2015-04-01 16:34:32 +00:00
|
|
|
}
|