2018-08-13 17:52:59 +00:00
|
|
|
package base
|
2018-08-10 17:50:09 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/nomad/plugins/shared/hclspec"
|
|
|
|
)
|
|
|
|
|
|
|
|
// MockPlugin is used for testing.
|
|
|
|
// Each function can be set as a closure to make assertions about how data
|
|
|
|
// is passed through the base plugin layer.
|
|
|
|
type MockPlugin struct {
|
|
|
|
PluginInfoF func() (*PluginInfoResponse, error)
|
|
|
|
ConfigSchemaF func() (*hclspec.Spec, error)
|
|
|
|
SetConfigF func([]byte) error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *MockPlugin) PluginInfo() (*PluginInfoResponse, error) { return p.PluginInfoF() }
|
|
|
|
func (p *MockPlugin) ConfigSchema() (*hclspec.Spec, error) { return p.ConfigSchemaF() }
|
|
|
|
func (p *MockPlugin) SetConfig(data []byte) error { return p.SetConfigF(data) }
|