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
// Set of environment variables to give the SandboxBuilder
Env map[string]string
// Mapping from hostname to handlers for proxies to attach to SandboxBuilder
Proxies map[string]http.Handler
// 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
// Whether or not this test-case should propagate success from engine to
// Finished. This equivalent to running in parallel with the "success" plugin.
PropagateSuccess bool
// If a regular expression is specified here, it must be in the task log
MatchLog string
// If a regular expression is specified here, it must _not_ be in the task 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 // TODO: Remove this and make it an argument for .Test(t)
// If true, the sandbox is expected to be aborted
SandboxAbort bool
// If true, requires that the plugin called StopNow
StoppedNow bool
// If true, requires that the plugin called StopGracefully
StoppedGracefully bool
// ClientID to be passed to TaskContext
ClientID string
// AccessToken to be passed to TaskContext
AccessToken string
// Certificate to be passed to TaskContext
Certificate string
// 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.
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
Click to show internal directories.
Click to hide internal directories.