framework

package
v3.0.0-...-a5432f4 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertDisplay

func AssertDisplay(t TB, events []engine.Event, path string)

func CloneSnapshot

func CloneSnapshot(t TB, snap *deploy.Snapshot) *deploy.Snapshot

CloneSnapshot makes a deep copy of the given snapshot and returns a pointer to the clone.

Types

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) Then

func (res *Result) Then(do func(snap *deploy.Snapshot, err error))

Then() is used to convey dependence between program runs via program structure.

type TB

type TB interface {
	Helper()
	Name() string
	Logf(format string, args ...any)
	Log(args ...any)
	Skipf(format string, args ...any)
	Skip(args ...any)
	SkipNow()
	Errorf(format string, args ...any)
	Error(args ...any)
	Fatalf(format string, args ...any)
	Fatal(args ...any)
	FailNow()
	Fail()
	Failed() bool
}

TB is a subset of testing.TB that admits other T-like things, such as *rapid.T from the Rapid property-testing library. It covers the set of functionality that we actually need for lifecycle testing, and satisfies the interfaces of testify.assert and testify.require.

type TestBuilder

type TestBuilder struct {
	// contains filtered or unexported fields
}

func NewTestBuilder

func NewTestBuilder(t *testing.T, snap *deploy.Snapshot) *TestBuilder

func (*TestBuilder) RunUpdate

func (b *TestBuilder) RunUpdate(
	program func(info plugin.RunInfo, monitor *deploytest.ResourceMonitor) error, skipDisplayTests bool,
) *Result

func (*TestBuilder) WithProvider

func (b *TestBuilder) WithProvider(name string, version string, prov *deploytest.Provider) *TestBuilder

type TestOp

func ImportOp

func ImportOp(imports []deploy.Import) TestOp

func (TestOp) Plan

func (op TestOp) Plan(project workspace.Project, target deploy.Target, opts TestUpdateOptions,
	backendClient deploy.BackendClient, validate ValidateFunc,
) (*deploy.Plan, error)

func (TestOp) Run

func (op TestOp) Run(project workspace.Project, target deploy.Target, opts TestUpdateOptions,
	dryRun bool, backendClient deploy.BackendClient, validate ValidateFunc,
) (*deploy.Snapshot, error)

func (TestOp) RunStep

func (op TestOp) RunStep(project workspace.Project, target deploy.Target, opts TestUpdateOptions,
	dryRun bool, backendClient deploy.BackendClient, validate ValidateFunc, name string,
) (*deploy.Snapshot, error)

func (TestOp) RunWithContext

func (op TestOp) RunWithContext(
	callerCtx context.Context, project workspace.Project,
	target deploy.Target, opts TestUpdateOptions, dryRun bool,
	backendClient deploy.BackendClient, validate ValidateFunc,
) (*deploy.Snapshot, error)

func (TestOp) RunWithContextStep

func (op TestOp) RunWithContextStep(
	callerCtx context.Context, project workspace.Project,
	target deploy.Target, opts TestUpdateOptions, dryRun bool,
	backendClient deploy.BackendClient, validate ValidateFunc, name string,
) (*deploy.Snapshot, error)

type TestPlan

type TestPlan struct {
	Project        string
	Stack          string
	Runtime        string
	RuntimeOptions map[string]interface{}
	Config         config.Map
	Decrypter      config.Decrypter
	BackendClient  deploy.BackendClient
	Options        TestUpdateOptions
	Steps          []TestStep
	// contains filtered or unexported fields
}

func (*TestPlan) GetProject

func (p *TestPlan) GetProject() workspace.Project

func (*TestPlan) GetTarget

func (p *TestPlan) GetTarget(t TB, snapshot *deploy.Snapshot) deploy.Target

func (*TestPlan) NewProviderURN

func (p *TestPlan) NewProviderURN(pkg tokens.Package, name string, parent resource.URN) resource.URN

func (*TestPlan) NewURN

func (p *TestPlan) NewURN(typ tokens.Type, name string, parent resource.URN) resource.URN

func (*TestPlan) Run

func (p *TestPlan) Run(t TB, snapshot *deploy.Snapshot) *deploy.Snapshot

func (*TestPlan) RunWithName

func (p *TestPlan) RunWithName(t TB, snapshot *deploy.Snapshot, name string) *deploy.Snapshot

type TestStep

type TestStep struct {
	Op            TestOp
	ExpectFailure bool
	SkipPreview   bool
	Validate      ValidateFunc
}

func MakeBasicLifecycleSteps

func MakeBasicLifecycleSteps(t *testing.T, resCount int) []TestStep

resCount is the expected number of resources registered during this test.

func (*TestStep) ValidateAnd

func (t *TestStep) ValidateAnd(f ValidateFunc)

type TestUpdateOptions

type TestUpdateOptions struct {
	engine.UpdateOptions
	// a factory to produce a plugin host for an update operation.
	HostF            deploytest.PluginHostFactory
	T                TB
	SkipDisplayTests bool
}

TestUpdateOptions is UpdateOptions for a TestPlan.

func (TestUpdateOptions) Options

Options produces UpdateOptions for an update operation.

type ValidateFunc

type ValidateFunc func(project workspace.Project, target deploy.Target, entries engine.JournalEntries,
	events []engine.Event, err error) error

Jump to

Keyboard shortcuts

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