opttest

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	Apply(*Options)
}

func AttachDownloadedPlugin

func AttachDownloadedPlugin(name, version string) Option

AttachDownloadedPlugin installs the plugin via `pulumi plugin install` then will start the provider and attach it for the test run.

func AttachProvider

func AttachProvider(name string, startProvider providers.ProviderFactory) Option

AttachProvider will start the provider via the specified factory and attach it when running the program under test.

func AttachProviderBinary

func AttachProviderBinary(name, path string) Option

AttachProviderBinary adds a provider to be started and attached for the test run. Path can be a directory or a binary. If it is a directory, the binary will be assumed to be pulumi-resource-<name> in that directory.

func AttachProviderServer

func AttachProviderServer(name string, startProvider providers.ResourceProviderServerFactory) Option

AttachProviderServer will start the specified and attach for the test run.

func ConfigPassphrase

func ConfigPassphrase(passphrase string) Option

SetConfigPassword sets the config passphrase to use when running the program under test.

func Defaults added in v0.0.6

func Defaults() Option

Defaults sets all options back to their defaults. This can be useful when using CopyToTempDir or Convert but not wanting to inherit any options from the previous PulumiTest.

func DisableGrpcLog added in v0.0.6

func DisableGrpcLog() Option

DisableGrpcLog disables the gRPC log which is written to grpc.log in the current working directory.

func DownloadProviderVersion added in v0.0.6

func DownloadProviderVersion(name, version string) Option

func Env

func Env(key, value string) Option

Set a custom environment variable to use when running the program under test.

func GoModReplacement

func GoModReplacement(packageSpecifier string, replacementPathElem ...string) Option

GoModReplacement specifies replacements to be add to the go.mod file when running the program under test. Each replacement is added to the go.mod file with `go mod edit -replace <replacement>` on stack creation.

func LocalProviderPath

func LocalProviderPath(name string, path ...string) Option

LocalProviderPath sets the path to the local provider binary to use when running the program under test. This sets the `plugins.providers` property in the project settings (Pulumi.yaml).

func NewStackOptions added in v0.0.7

func NewStackOptions(opts ...optnewstack.NewStackOpt) Option

func SkipInstall added in v0.0.6

func SkipInstall() Option

SkipInstall skips running `pulumi install` before running the program under test.

func SkipStackCreate added in v0.0.6

func SkipStackCreate() Option

SkipStackCreate skips creating the stack before running the program under test. A stack will have to be created manually before running the program under test.

func StackName added in v0.0.6

func StackName(name string) Option

StackName sets the default stack name to use when running the program under test.

func TestInPlace

func TestInPlace() Option

TestInPlace will run the program under test from its current location, rather than firstly copying to a temporary directory.

func UseAmbientBackend

func UseAmbientBackend() Option

UseAmbientBackend skips setting `PULUMI_BACKEND_URL` to a local temporary directory which overrides any backend configuration which might have been done on the local environment via `pulumi login`. Using this option will cause the program under test to use whatever backend configuration has been set via `pulumi login` or an existing `PULUMI_BACKEND_URL` value.

func WorkspaceOptions

func WorkspaceOptions(opts ...auto.LocalWorkspaceOption) Option

WorkspaceOptions sets additional options to pass to the workspace when running the program under test.

func YarnLink(packages ...string) Option

YarnLink specifies packages which are linked via `yarn link` and should be used when running the program under test. Each package is called with `yarn link <package>` on stack creation.

type Options

type Options struct {
	StackName             string
	SkipInstall           bool
	SkipStackCreate       bool
	NewStackOpts          []optnewstack.NewStackOpt
	TestInPlace           bool
	ConfigPassphrase      string
	Providers             map[providers.ProviderName]ProviderConfigUnion
	UseAmbientBackend     bool
	YarnLinks             []string
	GoModReplacements     map[string]string
	CustomEnv             map[string]string
	ExtraWorkspaceOptions []auto.LocalWorkspaceOption
	DisableGrpcLog        bool
}

func DefaultOptions

func DefaultOptions() *Options

func (*Options) Copy added in v0.0.6

func (o *Options) Copy() *Options

Copy creates a deep copy of the current options.

func (*Options) ProviderFactories

func (o *Options) ProviderFactories() map[providers.ProviderName]providers.ProviderFactory

func (*Options) ProviderPluginPaths

func (o *Options) ProviderPluginPaths() map[providers.ProviderName]string

type ProviderConfigUnion added in v0.0.6

type ProviderConfigUnion struct {
	Factory providers.ProviderFactory
	Path    string
}

ProviderConfigUnion is a union type for specifying a provider configuration. Only one of Factory or Path should be set.

Jump to

Keyboard shortcuts

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