Documentation
¶
Overview ¶
Package integration is a test library for validating in-memory providers behave correctly.
It sits just above the gRPC level. For full unit testing, see github.com/pulumi/pulumi/pkg/v3/testing/integration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LifeCycleTest ¶
LifeCycleTest describing the lifecycle of a resource test.
type MockCallArgs ¶
type MockCallArgs struct {
// Token indicates which function is being called. This token is of the form "package:module:function".
Token tokens.ModuleMember
// Args are the arguments provided to the function call.
Args property.Map
// Provider is the identifier of the provider instance being used to make the call.
Provider p.ProviderReference
}
MockCallArgs is used to construct a call Mock
type MockResourceArgs ¶
type MockResourceArgs struct {
// TypeToken is the token that indicates which resource type is being constructed. This token
// is of the form "package:module:type".
TypeToken tokens.Type
// Name is the logical name of the resource instance.
Name string
// Inputs are the inputs for the resource.
Inputs property.Map
// Provider is the identifier of the provider instance being used to manage this resource.
Provider p.ProviderReference
// ID is the physical identifier of an existing resource to read or import.
ID string
// Custom specifies whether or not the resource is Custom (i.e. managed by a resource provider).
Custom bool
// Full register RPC call, if available.
RegisterRPC *pulumirpc.RegisterResourceRequest
// Full read RPC call, if available
ReadRPC *pulumirpc.ReadResourceRequest
}
MockResourceArgs is a used to construct a newResource Mock
type MockResourceMonitor ¶
type MockResourceMonitor struct {
CallF func(args MockCallArgs) (property.Map, error)
NewResourceF func(args MockResourceArgs) (string, property.Map, error)
}
MockResourceMonitor mocks resource registration and function calls.
func (*MockResourceMonitor) Call ¶
func (m *MockResourceMonitor) Call(args pulumi.MockCallArgs) (presource.PropertyMap, error)
func (*MockResourceMonitor) NewResource ¶
func (m *MockResourceMonitor) NewResource(args pulumi.MockResourceArgs) (string, presource.PropertyMap, error)
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(inputs, 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
}
Operation describes a step in a LifeCycleTest.
TODO: Add support for diff verification.
type Server ¶
type Server interface {
GetSchema(p.GetSchemaRequest) (p.GetSchemaResponse, error)
Cancel() error
CheckConfig(p.CheckRequest) (p.CheckResponse, error)
DiffConfig(p.DiffRequest) (p.DiffResponse, error)
Configure(p.ConfigureRequest) error
Invoke(p.InvokeRequest) (p.InvokeResponse, error)
Check(p.CheckRequest) (p.CheckResponse, error)
Diff(p.DiffRequest) (p.DiffResponse, error)
Create(p.CreateRequest) (p.CreateResponse, error)
Read(p.ReadRequest) (p.ReadResponse, error)
Update(p.UpdateRequest) (p.UpdateResponse, error)
Delete(p.DeleteRequest) error
Construct(p.ConstructRequest) (p.ConstructResponse, error)
Call(p.CallRequest) (p.CallResponse, error)
}
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
func WithMocks ¶
func WithMocks(mocks pulumi.MockResourceMonitor) ServerOption
WithMocks allows injecting mock resources, helpful for testing a component which cretes child resources.
func WithProvider ¶
func WithProvider(p p.Provider) ServerOption
WithProvider backs the server with the given concrete provider.
func WithProviderF ¶
func WithProviderF(p func(*pprovider.HostClient) p.Provider) ServerOption
WithProviderF backs the server with a lazily initialized provider.