Beispiel #1
0
func (m *MockExecutablePlugin) WaitForResponse(t time.Duration) (*plugin.Response, error) {
	if m.Timeout {
		return nil, errors.New("timeout")
	}

	if m.NilResponse {
		return nil, nil
	}

	resp := new(plugin.Response)
	resp.Type = plugin.CollectorPluginType
	if m.PluginFailure {
		resp.State = plugin.PluginFailure
		resp.ErrorMessage = "plugin start error"
	}
	return resp, nil
}
Beispiel #2
0
func (m *MockExecutablePlugin) Run(t time.Duration) (plugin.Response, error) {
	if m.Timeout {
		return plugin.Response{}, errors.New("timeout")
	}

	if m.NilResponse {
		return plugin.Response{}, nil
	}

	var resp plugin.Response
	resp.Type = plugin.CollectorPluginType
	if m.PluginFailure {
		resp.State = plugin.PluginFailure
		resp.ErrorMessage = "plugin start error"
	}
	return resp, nil
}