tests

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeURN

func MakeURN(typ string) resource.URN

func Must1

func Must1[A any](a A, err error) A

Types

type LifeCycleTest

type LifeCycleTest struct {
	// Resource token
	Resource string
	// Create operation
	Create Operation
	// Update operations, in order
	Updates []Operation
	// Command to run before the final delete operation
	AssertBeforeDeleteCommand string
	// Command to run after the final delete operation
	AssertDeleteCommand string
}

func (LifeCycleTest) Run

func (l LifeCycleTest) Run(t *testing.T, harness *ProviderTestHarness)

type Operation

type Operation struct {
	// The inputs for the operation
	Inputs property.Map

	// The expected output for the operation. If ExpectedOutput is nil, no check
	// will be made.
	ExpectedOutput *property.Map

	// A function called on the output of this operation.
	Hook func(t *testing.T, inputs property.Map, output property.Map)

	// If the test should expect the operation to signal an error.
	ExpectFailure bool

	// If CheckFailures is non-nil, expect the check step to fail with the
	// provided output.
	CheckFailures []p.CheckFailure

	// The expected diff for this operation
	ExpectedDiff *p.DiffResponse

	// Command to run to assert test success
	AssertCommand string

	// Command to run before running the operation
	AssertBeforeCommand string

	// Command to run after the dry run but before the real operation
	AssertAfterDryRunCommand string

	// Command to run between delete and create operations in a replace-update
	// operation
	AssertInMiddleOfReplaceCommand string

	// Run a "refresh" (read) before the operation. Ignored on create.
	Refresh bool

	// If the test should expect the "refresh" to fail.
	ExpectRefreshFailure bool

	// A function called on the read outputs
	RefreshHook func(t *testing.T, res p.ReadResponse, err error)

	// Command to run after refresh (if enabled)
	AssertAfterRefreshCommand string
}

type ProviderTestHarness

type ProviderTestHarness struct {
	TestMachine *testmachine.TestMachine
	Provider    p.Provider
	Server      integration.Server
	Telemetry   *telemetry.TelemetryStuff
}

func NewProviderTestHarness

func NewProviderTestHarness(t *testing.T, tmConfig testmachine.Config) *ProviderTestHarness

func (*ProviderTestHarness) AssertCommand

func (harness *ProviderTestHarness) AssertCommand(t *testing.T, cmd string) bool

func (*ProviderTestHarness) Close

func (harness *ProviderTestHarness) Close()

Jump to

Keyboard shortcuts

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