acctest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvTfProviderSystemTargets = EnvPrefix + "TARGETS"

	EnvTfProviderSystemConfigPath = EnvPrefix + "CONFIG_PATH"
)
View Source
const (
	// EnvTfAcc refers to the TF_ACC environment variable
	EnvTfAcc = "TF_ACC"

	// EnvTfLog refers to the TF_LOG environment variable
	// https://www.terraform.io/plugin/log/managing#enable-logging
	EnvTfLog = "TF_LOG"

	// EnvTfAccTerraformPath refers to the TF_ACC_TERRAFORM_PATH environment variable
	EnvTfAccTerraformPath = "TF_ACC_TERRAFORM_PATH"
)

Environment variables defined by the Terraform acceptance test framework https://www.terraform.io/plugin/sdkv2/testing/acceptance-tests#environment-variables

View Source
const (
	DefaultTargetConfigId = "default"
)
View Source
const (
	// EnvPrefix is the prefix for all environment variables which are used to configure the acceptance tests
	// EnvPrefix is intentionally *different* from provider.Schema because different acceptance tests may test different provider configurations
	EnvPrefix = "TF_ACC_PROVIDER_SYSTEM_"
)

Variables

This section is empty.

Functions

func CurrentProviderConfigBlock

func CurrentProviderConfigBlock() tfbuild.FileElement

CurrentProviderConfigBlock returns the current configuration as a Terraform provider block Deprecated

func Initialize

func Initialize(m *testing.M) error

func ProviderConfigBlock

func ProviderConfigBlock(c ConfigTargetConfig) tfbuild.FileElement

ProviderConfigBlock is currently an alias for ProviderConfigBlockSshPasswordAuth

func ProviderConfigBlockSshPasswordAuth

func ProviderConfigBlockSshPasswordAuth(c ConfigTargetConfig) tfbuild.FileElement

ProviderConfigBlockSshPasswordAuth returns a provider configuration which uses ssh password authentication

func ProviderFactories

func ProviderFactories() providerFactoryMap

ProviderFactories returns the provider factories used in the acceptance tests

func RelevantForOS

func RelevantForOS(t *testing.T, target Target, ids ...string)

func SkipNotImplemented

func SkipNotImplemented(t *testing.T)

func SkipWhenOSEquals

func SkipWhenOSEquals(t *testing.T, target Target, ids ...string)

func SkipWhenOSNotEquals

func SkipWhenOSNotEquals(t *testing.T, target Target, ids ...string)

Types

type AccTest

type AccTest struct {
	// Id contains the unique id of the test run
	Id string

	Config Config

	Targets Targets
}

func Current

func Current() AccTest

Current returns the current AccTest instance of the acceptance test run

type Config

type Config struct {
	Targets map[string]ConfigTarget `yaml:"targets"`
}

type ConfigSsh

type ConfigSsh struct {
	Host       string `yaml:"host"`
	Port       int    `yaml:"port"`
	HostKey    string `yaml:"host_key"`
	User       string `yaml:"user"`
	Password   string `yaml:"password"`
	PrivateKey string `yaml:"private_key"`
	PublicKey  string `yaml:"public_key"`
}

type ConfigTarget

type ConfigTarget struct {
	Os      ConfigTargetOs        `yaml:"os"`
	Configs ConfigTargetConfigMap `yaml:"configs"`
}

type ConfigTargetConfig

type ConfigTargetConfig struct {
	Ssh ConfigSsh `yaml:"ssh"`
}

type ConfigTargetConfigMap

type ConfigTargetConfigMap map[string]ConfigTargetConfig

func (ConfigTargetConfigMap) Default

func (ConfigTargetConfigMap) Get

func (ConfigTargetConfigMap) MustGet

type ConfigTargetOs

type ConfigTargetOs struct {
	Id      string `yaml:"id"`
	Name    string `yaml:"name"`
	Vendor  string `yaml:"vendor"`
	Version string `yaml:"version"`
	Release string `yaml:"release"`
}

type EnvConfig

type EnvConfig struct {
	// Targets is a list of target identifiers to include in the acceptance test run
	Targets []string `env:"TARGETS"`

	// ConfigPath is the path to the config yaml
	ConfigPath string `env:"CONFIG_PATH,default=acctest.yaml"`
}

EnvConfig represents the acceptance test configuration which is provided by environment variables

type Target

type Target struct {
	ConfigTarget

	// Id which uniquely identifies the target
	Id string

	// BasePath is the path on the remote system in which all tests are executed
	BasePath string

	// Prefix is used for naming resource and contains the Id
	Prefix string

	Provider *provider.Provider
}

type Targets

type Targets []Target

func (Targets) Foreach

func (targets Targets) Foreach(t *testing.T, f func(*testing.T, Target))

Foreach is a convenience function to run a test for multiple targets

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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