Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDummyPlugins(t *testing.T, cfg Plugins) string
- func PluginCommand(t *testing.T, cfg PluginCfg) (*exec.Cmd, func() (*PluginResult, error))
- func PluginProcess(cfg *PluginCfg)
- func PluginProcessFromBinaryName(name string)
- type CrashBehaviour
- type PluginBehaviour
- type PluginCfg
- type PluginResult
- type Plugins
Constants ¶
const (
MockSecretValue = "MockSecretValue"
)
Variables ¶
var MockSecretID = secrets.MustParseID("MockSecretID")
Functions ¶
func CreateDummyPlugins ¶
CreateDummyPlugins Use it in a test to create a set of dummy plugins that behave like normal plugins but under the hood re-use the test binary. This is the counterpart to dummyPluginProcessFromBinaryName().
func PluginCommand ¶
PluginCommand can be called from within tests. The returned *exec.Cmd runs the PluginProcess() that implements the plugin.Plugin interface, i.e., we get a normal external plugin binary. Under the hood, it re-runs the existing test binary (created by go test) with different parameters. The TestMain acts as a switch to then instead running as normal test to run PluginProcess().
func PluginProcess ¶
func PluginProcess(cfg *PluginCfg)
PluginProcess is the equivalent of a main when normally implementing a plugin. Here, it gets run by TestMain if PluginCommand is used to re-launch the test binary (the binary built by go test).
func PluginProcessFromBinaryName ¶
func PluginProcessFromBinaryName(name string)
PluginProcessFromBinaryName configures and runs a dummy plugin process. To be used from TestMain.
Types ¶
type CrashBehaviour ¶
type PluginBehaviour ¶
type PluginBehaviour struct {
Value string `json:"value"`
*CrashBehaviour
}
func ParsePluginBehaviour ¶
func ParsePluginBehaviour(s string) (PluginBehaviour, error)
func (PluginBehaviour) ToString ¶
func (p PluginBehaviour) ToString() (string, error)
type PluginCfg ¶
type PluginCfg struct {
Version string `json:"version"`
Pattern string `json:"pattern"`
Secrets map[string]string `json:"secrets"`
ErrGetSecret string `json:"errGetSecret,omitempty"`
IgnoreSigint bool `json:"ignoreSigint,omitempty"`
ErrConfigPanic string `json:"errConfigPanic,omitempty"`
*CrashBehaviour
}
type PluginResult ¶
type Plugins ¶
type Plugins struct {
FailPlugin bool
Plugins []PluginBehaviour
}