repository

package
v0.0.0-...-a93a756 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ExampleGraph is an example of a graph specification
	ExampleGraph = &adagio.GraphSpec{
		Nodes: []*adagio.Node_Spec{
			a,
			b,
			c,
			d,
			e,
			f,
			g,
		},
		Edges: []*adagio.Edge{
			{Source: a.Name, Destination: c.Name},
			{Source: a.Name, Destination: d.Name},
			{Source: b.Name, Destination: d.Name},
			{Source: b.Name, Destination: f.Name},
			{Source: c.Name, Destination: e.Name},
			{Source: d.Name, Destination: e.Name},
			{Source: e.Name, Destination: g.Name},
			{Source: f.Name, Destination: g.Name},
		},
	}
)

Functions

func TestHarness

func TestHarness(t *testing.T, repoFn Constructor)

TestHarness is a test suite which a repository must pass in order to be deemed appropriate as an adagio repository.

It runs a number of import scenarios against the repository implementation which include attempts to make concurrent claims, attempts to finish node appropriately, attempts to handle orphaned nodes and so on.

Types

type Constructor

type Constructor func(func() time.Time) (Repository, Orphaner)

Constructor is a function which constructs a repository and orphaner when provded a function which returns a time (now)

type OrphanFunc

type OrphanFunc func(*adagio.Claim)

OrphanFunc is a function which can be used as an Orphaner

func (OrphanFunc) Orphan

func (o OrphanFunc) Orphan(c *adagio.Claim)

Orphan delegates to the underlying OrphanFunc

type Orphaner

type Orphaner interface {
	Orphan(claim *adagio.Claim)
}

Orphaner is a type which can trigger the orphaning of a node based on a claim

type Repository

type Repository interface {
	controlplane.Repository
	agent.Repository
}

Repository is a combination of the controlplane and agent repository types

type TestLayer

type TestLayer struct {
	Name        string
	Repository  Repository
	Run         *adagio.Run
	Unclaimable []string
	Claimable   map[string]*adagio.Node
	Finish      map[string]adagio.Node_Result_Conclusion
	Events      []*adagio.Event
	RunStatus   adagio.Run_Status
}

TestLayer is used by the TestHarness to run a prebaked scenario of calls (claims and finishes) and expect a state of the world

func (*TestLayer) Exec

func (l *TestLayer) Exec(ctx context.Context, t *testing.T)

Exec executes the test layer against the provided testing T given a context

Jump to

Keyboard shortcuts

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