testscripts

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllAtOnce = &core.ScriptDescriptor{
	Name:        "all_at_once",
	Description: "Test script for all at once harvesting mode",
	Mode:        core.AllAtOnce,
	DefaultOptions: func() interface{} {
		return &optionsAllAtOnce{
			Gauges:     10,
			Value:      0,
			Min:        10,
			Max:        20,
			NoLocation: false,
		}
	},
	Factory: func(name string, options interface{}) (core.Script, error) {
		if opts, ok := options.(*optionsAllAtOnce); ok {
			return &scriptAllAtOnce{name: name, options: *opts}, nil
		}
		return nil, fmt.Errorf("failed to cast %T", optionsAllAtOnce{})
	},
}
View Source
var Batched = &core.ScriptDescriptor{
	Name:        "batched",
	Description: "Test script for batched harvesting mode",
	Mode:        core.Batched,
	DefaultOptions: func() interface{} {
		return &BatchedOptions{
			Gauges:    10,
			Value:     0,
			Min:       10,
			Max:       20,
			BatchSize: 3,
		}
	},
	Factory: func(name string, options interface{}) (core.Script, error) {
		if opts, ok := options.(*BatchedOptions); ok {
			return &scriptBatched{name: name, options: *opts}, nil
		}
		return nil, fmt.Errorf("failed to cast %T", BatchedOptions{})
	},
}
View Source
var Broken = &core.ScriptDescriptor{
	Name:        "broken",
	Description: "Test script that always returns error",
	Mode:        core.AllAtOnce,
	DefaultOptions: func() interface{} {
		return &optionsBroken{}
	},
	Factory: func(name string, options interface{}) (core.Script, error) {
		return &scriptBroken{}, nil
	},
}
View Source
var OneByOne = &core.ScriptDescriptor{
	Name:        "one_by_one",
	Description: "Test script for one by one harvesting mode",
	Mode:        core.OneByOne,
	DefaultOptions: func() interface{} {
		return &OneByOneOptions{
			Gauges: 10,
			Value:  0,
			Min:    10,
			Max:    20,
		}
	},
	Factory: func(name string, options interface{}) (core.Script, error) {
		if opts, ok := options.(*OneByOneOptions); ok {
			return &scriptOneByOne{name: name, options: *opts}, nil
		}
		return nil, fmt.Errorf("failed to cast %T", OneByOneOptions{})
	},
}

Functions

This section is empty.

Types

type BatchedOptions added in v1.7.0

type BatchedOptions struct {
	Gauges    int     `desc:"Number of gauges"`
	Value     float64 `desc:"Set this to return fixed value. Has priority over min/max"`
	Min       float64 `desc:"Set this and max to return random values within interval"`
	Max       float64 `desc:"Set this and min to return random values within interval"`
	BatchSize int     `desc:"Number of gauges in batch"`
}

BatchedOptions is public for global test purposes

func (BatchedOptions) GetBatchSize added in v1.7.0

func (o BatchedOptions) GetBatchSize() int

GetBatchSize Implements core.BatchableOptions interface

type OneByOneOptions

type OneByOneOptions struct {
	Gauges int     `desc:"Number of gauges"`
	Value  float64 `desc:"Set this to return fixed value. Has priority over min/max"`
	Min    float64 `desc:"Set this and max to return random values within interval"`
	Max    float64 `desc:"Set this and min to return random values within interval"`
}

OneByOneOptions is public for global test purposes

Jump to

Keyboard shortcuts

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