Documentation ¶
Index ¶
- Variables
- type Job
- func (j *Job) AddScenario(scenario *Scenario)
- func (j *Job) AddStep(step Step, opts *StepOptions)
- func (j *Job) GetPrettyStepName(step *StepWrapper) string
- func (j *Job) GetValue(stepw *StepWrapper, key string) (string, bool)
- func (j *Job) GetValues(stepw *StepWrapper, key string) string
- func (j *Job) Run() error
- func (j *Job) SetGetValues(stepw *StepWrapper, key, value string) (string, error)
- func (j *Job) Validate() error
- type JobValues
- type Runner
- type Scenario
- type Sleep
- type Step
- type StepOptions
- type StepWrapper
- type Stop
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyDescription = fmt.Errorf("job description is empty") ErrNonNilError = fmt.Errorf("expected error to be non-nil") ErrNilError = fmt.Errorf("expected error to be nil") ErrMissingParameter = fmt.Errorf("missing parameter") ErrParameterAlreadySet = fmt.Errorf("parameter already set") ErrOrphanSteps = fmt.Errorf("background steps with no corresponding stop") ErrCannotStopStep = fmt.Errorf("cannot stop step") ErrMissingBackroundID = fmt.Errorf("missing background id") ErrNoValue = fmt.Errorf("empty parameter not found saved in values") ErrEmptyScenarioName = fmt.Errorf("scenario name is empty") )
var ( ErrValueAlreadySet = fmt.Errorf("parameter already set in values") ErrEmptyValue = fmt.Errorf("empty parameter not found in values") )
var DefaultOpts = StepOptions{ ExpectError: false, SkipSavingParamatersToJob: false, }
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct { Description string Steps []*StepWrapper BackgroundSteps map[string]*StepWrapper Scenarios map[*StepWrapper]*Scenario // contains filtered or unexported fields }
A Job is a logical grouping of steps, options and values
func (*Job) AddScenario ¶
func (*Job) AddStep ¶
func (j *Job) AddStep(step Step, opts *StepOptions)
func (*Job) GetPrettyStepName ¶
func (j *Job) GetPrettyStepName(step *StepWrapper) string
func (*Job) GetValues ¶
func (j *Job) GetValues(stepw *StepWrapper, key string) string
GetValues is used when we want to skip saving parameters to job, but also check if the parameter exists in the scenario's or top level values
func (*Job) SetGetValues ¶
func (j *Job) SetGetValues(stepw *StepWrapper, key, value string) (string, error)
SetGetValues is used when we want to save parameters to job, and also check if the parameter exists in the scenario's or top level values
type Runner ¶
type Runner struct { Job *Job // contains filtered or unexported fields }
A wrapper around a job, so that internal job components don't require things like *testing.T and can be reused elsewhere
type Scenario ¶
type Scenario struct {
// contains filtered or unexported fields
}
A Scenario is a logical grouping of steps, used to describe a scenario such as "test drop metrics" which will require port forwarding, exec'ing, scraping, etc.
func NewScenario ¶
func NewScenario(name string, steps ...*StepWrapper) *Scenario
type Sleep ¶
func (*Sleep) Prevalidate ¶
type Step ¶
type Step interface { // Useful when wanting to do parameter checking, for example // if a parameter length is known to be required less than 80 characters, // do this here so we don't find out later on when we run the step // when possible, try to avoid making external calls, this should be fast and simple Prevalidate() error // Primary step where test logic is executed // Returning an error will cause the test to fail Run() error // Require for background steps Stop() error }
type StepOptions ¶
type StepOptions struct { ExpectError bool // Generally set this to false when you want to reuse // a step, but you don't want to save the parameters // ex: Sleep for 15 seconds, then Sleep for 10 seconds, // you don't want to save the parameters SkipSavingParamatersToJob bool // Will save this step to the job's steps // and then later on when Stop is called with job name, // it will call Stop() on the step RunInBackgroundWithID string }
type StepWrapper ¶
type StepWrapper struct { Step Step Opts *StepOptions }
A StepWrapper is a coupling of a step and it's options