Documentation ¶
Index ¶
- type ActiveVU
- type MiniRunner
- func (r MiniRunner) GetDefaultGroup() *libWorker.Group
- func (r MiniRunner) GetOptions() libWorker.Options
- func (r MiniRunner) GetSetupData() []byte
- func (r *MiniRunner) HandleSummary(ctx context.Context, s *libWorker.Summary) (map[string]io.Reader, error)
- func (r MiniRunner) IsExecutable(name string) bool
- func (r MiniRunner) MakeArchive() *libWorker.Archive
- func (r *MiniRunner) NewVU(idLocal, idGlobal uint64, out chan<- workerMetrics.SampleContainer, ...) (libWorker.InitializedVU, error)
- func (r *MiniRunner) SetOptions(opts libWorker.Options) error
- func (r *MiniRunner) SetSetupData(data []byte)
- func (r *MiniRunner) Setup(ctx context.Context, out chan<- workerMetrics.SampleContainer) (err error)
- func (r MiniRunner) Teardown(ctx context.Context, out chan<- workerMetrics.SampleContainer) error
- type VU
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveVU ¶
type ActiveVU struct { *VU *libWorker.VUActivationParams // contains filtered or unexported fields }
ActiveVU holds a VU and its activation parameters
type MiniRunner ¶
type MiniRunner struct { Fn func(ctx context.Context, state *libWorker.State, out chan<- workerMetrics.SampleContainer) error SetupFn func(ctx context.Context, out chan<- workerMetrics.SampleContainer) ([]byte, error) TeardownFn func(ctx context.Context, out chan<- workerMetrics.SampleContainer) error HandleSummaryFn func(context.Context, *libWorker.Summary) (map[string]io.Reader, error) SetupData []byte Group *libWorker.Group Options libWorker.Options }
MiniRunner partially implements the libWorker.Runner interface, but instead of using a real JS runtime, it allows us to directly specify the options and functions with Go code.
func (MiniRunner) GetDefaultGroup ¶
func (r MiniRunner) GetDefaultGroup() *libWorker.Group
GetDefaultGroup returns the default group.
func (MiniRunner) GetOptions ¶
func (r MiniRunner) GetOptions() libWorker.Options
GetOptions returns the supplied options struct.
func (MiniRunner) GetSetupData ¶
func (r MiniRunner) GetSetupData() []byte
GetSetupData returns json representation of the setup data if setup() is specified and was ran, nil otherwise.
func (*MiniRunner) HandleSummary ¶
func (r *MiniRunner) HandleSummary(ctx context.Context, s *libWorker.Summary) (map[string]io.Reader, error)
HandleSummary calls the specified summary callback, if supplied.
func (MiniRunner) IsExecutable ¶
func (r MiniRunner) IsExecutable(name string) bool
IsExecutable satisfies libWorker.Runner, but is mocked for MiniRunner since it doesn't deal with JS.
func (MiniRunner) MakeArchive ¶
func (r MiniRunner) MakeArchive() *libWorker.Archive
MakeArchive isn't implemented, it always returns nil and is just here to satisfy the libWorker.Runner interface.
func (*MiniRunner) NewVU ¶
func (r *MiniRunner) NewVU(idLocal, idGlobal uint64, out chan<- workerMetrics.SampleContainer, workerInfo *libWorker.WorkerInfo) (libWorker.InitializedVU, error)
NewVU returns a new VU with an incremental ID.
func (*MiniRunner) SetOptions ¶
func (r *MiniRunner) SetOptions(opts libWorker.Options) error
SetOptions allows you to override the runner options.
func (*MiniRunner) SetSetupData ¶
func (r *MiniRunner) SetSetupData(data []byte)
SetSetupData saves the externally supplied setup data as JSON in the runner.
func (*MiniRunner) Setup ¶
func (r *MiniRunner) Setup(ctx context.Context, out chan<- workerMetrics.SampleContainer) (err error)
Setup calls the supplied mock setup() function, if present.
func (MiniRunner) Teardown ¶
func (r MiniRunner) Teardown(ctx context.Context, out chan<- workerMetrics.SampleContainer) error
Teardown calls the supplied mock teardown() function, if present.
type VU ¶
type VU struct { R *MiniRunner Out chan<- workerMetrics.SampleContainer ID, IDGlobal uint64 Iteration int64 // contains filtered or unexported fields }
VU is a mock VU, spawned by a MiniRunner.