core

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {

	// TODO: completely remove the engine and use all of these separately, in a
	// much more composable and testable manner
	ExecutionScheduler libWorker.ExecutionScheduler
	MetricsEngine      *engine.MetricsEngine
	OutputManager      *output.Manager

	Samples chan workerMetrics.SampleContainer
	// contains filtered or unexported fields
}

The Engine is the beating heart of k6.

func NewEngine

func NewEngine(testState *libWorker.TestRunState, ex libWorker.ExecutionScheduler, outputs []output.Output) (*Engine, error)

NewEngine instantiates a new Engine, without doing any heavy initialization.

func (*Engine) Init

func (e *Engine) Init(globalCtx, runCtx context.Context, workerInfo *libWorker.WorkerInfo) (run func() error, wait func(), err error)

Init is used to initialize the execution scheduler and all metrics processing in the engine. The first is a costly operation, since it initializes all of the planned VUs and could potentially take a long time.

This method either returns an error immediately, or it returns test run() and wait() functions.

Things to note:

  • The first lambda, Run(), synchronously executes the actual load test.
  • It can be prematurely aborted by cancelling the runCtx - this won't stop the metrics collection by the Engine.
  • Stopping the metrics collection can be done at any time after Run() has returned by cancelling the globalCtx
  • The second returned lambda can be used to wait for that process to finish.

func (*Engine) IsStopped

func (e *Engine) IsStopped() bool

IsStopped returns a bool indicating whether the Engine has been stopped

func (*Engine) IsTainted

func (e *Engine) IsTainted() bool

func (*Engine) Stop

func (e *Engine) Stop()

Stop closes a signal channel, forcing a running Engine to return

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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