Back to godoc.org

Package plan

v0.0.0-...-04cb870
Latest Go to latest

The latest major version is .

Published: Aug 5, 2020 | License: GPL3 | Module: github.com/qri-io/test-plans

Index

Constants

const FinishedState = sync.State("finished")

FinishedState coordinates plan completion

Variables

var ActorInfoTopic = sync.NewTopic("actor-info", &sim.ActorInfo{})

ActorInfoTopic represents a subtree under the test run's sync tree where peers participating in this distributed test advertise their attributes

var ReadyStateActorInfoSync = sync.State("actor info published")
var ReadyStateConstructed = sync.State("actor constructed")

ReadyStateConstructed is the state to sync on to ensure all actors have been constructed before moving on

type ActorConstructor

type ActorConstructor func(context.Context, *Plan) (*sim.Actor, error)

ActorConstructor is a function that creates an actor

type Plan

type Plan struct {
	Cfg    *PlanConfig
	Runenv *runtime.RunEnv
	Client *sync.Client

	Seq int64
	Wg  *wg.WaitGroup

	Actor  *sim.Actor
	Others map[string]*sim.ActorInfo
	// contains filtered or unexported fields
}

Plan holds state for test plan execution, one plan instance is constructed per node in the plan, with methods for syncronizing plan instances out-of-band from the test itself

func NewPlan

func NewPlan(ctx context.Context, runenv *runtime.RunEnv) *Plan

NewPlan creates a plan instance from runtime data

func (*Plan) ActorFinished

func (plan *Plan) ActorFinished(ctx context.Context) error

ActorFinished marks this actor as having completed their goal for the plan

func (*Plan) Close

func (plan *Plan) Close()

Close finalizes the plan & cleans up resources

func (*Plan) ConstructActor

func (plan *Plan) ConstructActor(ctx context.Context, constructor ActorConstructor) error

ConstructActor creates an actor and assigns it to the plan it's mainly sugar for presnting a uniform plan execution API

func (*Plan) Finished

func (plan *Plan) Finished(ctx context.Context) <-chan error

Finished blocks until the plan is finished

func (*Plan) SetupNetwork

func (plan *Plan) SetupNetwork(ctx context.Context) error

SetupNetwork configures the network for plan execution

func (*Plan) ShareInfo

func (plan *Plan) ShareInfo(ctx context.Context) error

ShareInfo sends the nodes AddrInfo to all other nodes as well as stores the other nodes info in its peerstore

type PlanConfig

type PlanConfig struct {
	Timeout time.Duration
	Latency time.Duration
}

PlanConfig encapsulates test plan paremeters

func PlanConfigFromRuntimeEnv

func PlanConfigFromRuntimeEnv(runenv *runtime.RunEnv) *PlanConfig

PlanConfigFromRuntimeEnv parses configuration from the runtime environment

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier