plugintest

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2016 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case struct {
	// A payload that will be passed to the sandbox and plugin
	Payload string
	// The plugin under test. This should be the name that is registered
	Plugin string
	// JSON configuration for the plugin
	PluginConfig string
	// Whether or not plugin.Stopped() should return true
	PluginSuccess bool
	// Whether or not engine.ResultSet.Success() should return true
	EngineSuccess bool
	// If a regular expression is specified here, it must be in the sandbox log
	MatchLog string
	// If a regular expression is specified here, it must _not_ be in the sandbox log
	NotMatchLog string
	// A mocked out queue client
	QueueMock *client.MockQueue
	// Override the default generated TaskID
	TaskID string
	// Override the default generated TaskID
	RunID int
	// A testing struct can be useful inside for assertions
	TestStruct *testing.T

	// Each of these functions is called at the time specified in the name
	BeforeBuildSandbox func(Options)
	AfterBuildSandbox  func(Options)
	BeforeStarted      func(Options)
	AfterStarted       func(Options)
	BeforeStopped      func(Options)
	AfterStopped       func(Options)
	BeforeFinished     func(Options)
	AfterFinished      func(Options)
	BeforeDisposed     func(Options)
	AfterDisposed      func(Options)
}

The Case is a testcase for a plugin. This specifies a few ways to ensure that the plugin has done what is expected. It works very closely with mockengine and using the functions part of the payload to modify how that works is very useful.

func (Case) Test

func (c Case) Test()

Test is called to trigger a plugintest.Case to run

type Options

type Options struct {
	Environment    *runtime.Environment
	SandboxBuilder engines.SandboxBuilder
	Engine         engines.Engine
	ResultSet      engines.ResultSet
	Plugin         plugins.Plugin
	TaskPlugin     plugins.TaskPlugin
}

The Options contains options available to any of the Before* or After* functions in plugintest.Case

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL