Skip to main content

RunPluginEndToEndTest

No overview available.

def RunPluginEndToEndTest(
t: *testing.T,
executor: pluginCore.Plugin,
template: *idlCore.TaskTemplate,
inputs: *idlCore.LiteralMap,
expectedOutputs: *idlCore.LiteralMap,
expectedFailure: *idlCore.ExecutionError,
iterationUpdate: func(ctx context.Context, tCtx pluginCore.TaskExecutionContext) error
) - > pluginCore.PhaseInfo

Executes a plugin end-to-end test by setting up a mocked task execution context, running the provided plugin's handler, and asserting the outputs or failures against expected values. This function is used to simulate a plugin's execution flow in an isolated testing environment.

Parameters

NameTypeDescription
t*testing.TThe testing context provided by the Go testing framework, used for assertions and reporting test failures.
executorpluginCore.PluginThe plugin instance to be tested, which will have its Handle method invoked during the test.
template*idlCore.TaskTemplateThe task template defining the structure and configuration of the task being executed by the plugin.
inputs*idlCore.LiteralMapThe literal map representing the input data provided to the plugin for execution.
expectedOutputs*idlCore.LiteralMapThe expected literal map of outputs if the plugin execution is successful. If provided, the test asserts that the actual outputs match these.
expectedFailure*idlCore.ExecutionErrorThe expected execution error if the plugin execution is expected to fail. If provided, the test asserts that the actual error matches this.
iterationUpdatefunc(ctx context.Context, tCtx pluginCore.TaskExecutionContext) errorAn optional callback function that is executed after each iteration of the plugin's Handle method, allowing for custom logic or assertions during the execution loop.

Returns

TypeDescription
pluginCore.PhaseInfoThe final phase information of the plugin execution, indicating success, failure, or other terminal states.