Documentation ¶
Index ¶
- type ConvertResult
- type PT
- type PulumiTest
- func (pt *PulumiTest) ClearGrpcLog()
- func (a *PulumiTest) Context() context.Context
- func (a *PulumiTest) Convert(language string, opts ...opttest.Option) ConvertResult
- func (a *PulumiTest) CopyTo(dir string, opts ...opttest.Option) *PulumiTest
- func (a *PulumiTest) CopyToTempDir(opts ...opttest.Option) *PulumiTest
- func (a *PulumiTest) CurrentStack() *auto.Stack
- func (a *PulumiTest) Destroy(opts ...optdestroy.Option) auto.DestroyResult
- func (a *PulumiTest) ExportStack() apitype.UntypedDeployment
- func (pt *PulumiTest) GrpcLog() *grpclog.GrpcLog
- func (a *PulumiTest) Import(resourceType, resourceName, resourceID string, providerUrn string, ...) cmdOutput
- func (a *PulumiTest) ImportStack(source apitype.UntypedDeployment)
- func (a *PulumiTest) Install() string
- func (pt *PulumiTest) InstallStack(stackName string, opts ...optnewstack.NewStackOpt) *PulumiTest
- func (pt *PulumiTest) NewStack(stackName string, opts ...optnewstack.NewStackOpt) *auto.Stack
- func (a *PulumiTest) Preview(opts ...optpreview.Option) auto.PreviewResult
- func (a *PulumiTest) Refresh(opts ...optrefresh.Option) auto.RefreshResult
- func (pulumiTest *PulumiTest) Run(execute func(test *PulumiTest), opts ...optrun.Option) *PulumiTest
- func (a *PulumiTest) SetConfig(key, value string)
- func (a *PulumiTest) Source() string
- func (a *PulumiTest) Up(opts ...optup.Option) auto.UpResult
- func (a *PulumiTest) UpdateSource(pathElems ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConvertResult ¶
type ConvertResult struct { // PulumiTest instance for the converted program. PulumiTest *PulumiTest // Combined output of the `pulumi convert` command. Output string }
type PT ¶ added in v0.0.12
type PT interface { Name() string TempDir() string Log(...any) Fail() FailNow() Cleanup(func()) Helper() Deadline() (time.Time, bool) }
A subset of *testing.T functionality used by pulumitest.
type PulumiTest ¶
type PulumiTest struct {
// contains filtered or unexported fields
}
func NewPulumiTest ¶
func NewPulumiTest(t PT, source string, opts ...opttest.Option) *PulumiTest
NewPulumiTest creates a new PulumiTest instance. By default it will: 1. Copy the source to a temporary directory. 2. Install dependencies. 3. Create a new stack called "test" with state stored to a local temporary directory and a fixed passphrase for encryption.
func (*PulumiTest) ClearGrpcLog ¶ added in v0.0.11
func (pt *PulumiTest) ClearGrpcLog()
ClearGrpcLog clears the gRPC log for the current stack based on the PULUMI_DEBUG_GRPC env var.
func (*PulumiTest) Context ¶
func (a *PulumiTest) Context() context.Context
Context returns the current context.Context instance used for automation API calls.
func (*PulumiTest) Convert ¶
func (a *PulumiTest) Convert(language string, opts ...opttest.Option) ConvertResult
Convert a program to a given language. It returns a new PulumiTest instance for the converted program which will be outputted into a temporary directory.
func (*PulumiTest) CopyTo ¶ added in v0.0.6
func (a *PulumiTest) CopyTo(dir string, opts ...opttest.Option) *PulumiTest
CopyTo copies the program to the specified directory. It returns a new PulumiTest instance for the copied program.
func (*PulumiTest) CopyToTempDir ¶
func (a *PulumiTest) CopyToTempDir(opts ...opttest.Option) *PulumiTest
CopyToTempDir copies the program to a temporary directory. It returns a new PulumiTest instance for the copied program. This is used to avoid temporary files being written to the source directory.
func (*PulumiTest) CurrentStack ¶
func (a *PulumiTest) CurrentStack() *auto.Stack
CurrentStack returns the last stack that was created or nil if no stack has been created yet.
func (*PulumiTest) Destroy ¶
func (a *PulumiTest) Destroy(opts ...optdestroy.Option) auto.DestroyResult
Up deploys the current stack.
func (*PulumiTest) ExportStack ¶
func (a *PulumiTest) ExportStack() apitype.UntypedDeployment
ExportStack exports the current stack state.
func (*PulumiTest) GrpcLog ¶ added in v0.0.6
func (pt *PulumiTest) GrpcLog() *grpclog.GrpcLog
GrpcLog reads the gRPC log for the current stack based on the PULUMI_DEBUG_GRPC env var.
func (*PulumiTest) Import ¶ added in v0.0.14
func (a *PulumiTest) Import( resourceType, resourceName, resourceID string, providerUrn string, args ...string, ) cmdOutput
func (*PulumiTest) ImportStack ¶
func (a *PulumiTest) ImportStack(source apitype.UntypedDeployment)
ImportStack imports the given stack state into the test's current stack.
func (*PulumiTest) Install ¶
func (a *PulumiTest) Install() string
Install installs packages and plugins for a given directory by running `pulumi install`.
func (*PulumiTest) InstallStack ¶
func (pt *PulumiTest) InstallStack(stackName string, opts ...optnewstack.NewStackOpt) *PulumiTest
InstallStack installs packages, and creates a new stack.
func (*PulumiTest) NewStack ¶
func (pt *PulumiTest) NewStack(stackName string, opts ...optnewstack.NewStackOpt) *auto.Stack
NewStack creates a new stack, ensure it's cleaned up after the test is done. If no stack name is provided, a random one will be generated.
func (*PulumiTest) Preview ¶
func (a *PulumiTest) Preview(opts ...optpreview.Option) auto.PreviewResult
Preview previews an update to the current stack.
func (*PulumiTest) Refresh ¶
func (a *PulumiTest) Refresh(opts ...optrefresh.Option) auto.RefreshResult
Refresh refreshes the current stack.
func (*PulumiTest) Run ¶ added in v0.0.6
func (pulumiTest *PulumiTest) Run(execute func(test *PulumiTest), opts ...optrun.Option) *PulumiTest
Run will run the `execute` function in an isolated temp directory and with additional test options, then import the resulting stack state into the original test. WithCache can be used to skip executing the run and return the cached stack state if available, or to cache the stack state after executing the run. Options will be inherited from the original test, but can be added to with `optrun.WithOpts` or reset with `opttest.Defaults()`.
func (*PulumiTest) SetConfig ¶
func (a *PulumiTest) SetConfig(key, value string)
func (*PulumiTest) Source ¶
func (a *PulumiTest) Source() string
Source returns the current source directory.
func (*PulumiTest) Up ¶
func (a *PulumiTest) Up(opts ...optup.Option) auto.UpResult
Up deploys the current stack.
func (*PulumiTest) UpdateSource ¶
func (a *PulumiTest) UpdateSource(pathElems ...string)
Copy files from a source directory to the current program directory.