acceptance

package
v2.20.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SkipInstanceReadyPollKey = "skip_instance_ready_poll"
)

Variables

View Source
var (
	PublicKeyMaterial        string
	TestAccProviders         map[string]*schema.Provider
	TestAccProvider          *schema.Provider
	TestAccFrameworkProvider *linode.FrameworkProvider
	ConfigTemplates          *template.Template
	TestImageLatest          string
	TestImagePrevious        string
)
View Source
var ProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){
	"linode": func() (tfprotov5.ProviderServer, error) {
		ctx := context.Background()
		providers := []func() tfprotov5.ProviderServer{
			TestAccProviders["linode"].GRPCProvider,
			providerserver.NewProtocol5(
				TestAccFrameworkProvider,
			),
		}

		muxServer, err := tf5muxserver.NewMuxServer(ctx, providers...)
		if err != nil {
			return nil, err
		}

		return muxServer.ProviderServer(), nil
	},
}

Functions

func AssertInstanceReboot

func AssertInstanceReboot(t *testing.T, shouldRestart bool, instance *linodego.Instance) func()

func CheckEventAbsent

func CheckEventAbsent(name string, entityType linodego.EntityType, action linodego.EventAction) resource.TestCheckFunc

func CheckFirewallExists

func CheckFirewallExists(name string, firewall *linodego.Firewall) resource.TestCheckFunc

func CheckInstanceDestroy

func CheckInstanceDestroy(s *terraform.State) error

func CheckInstanceExists

func CheckInstanceExists(name string, instance *linodego.Instance) resource.TestCheckFunc

func CheckLKEClusterDestroy

func CheckLKEClusterDestroy(s *terraform.State) error

func CheckListContains

func CheckListContains(resName, path, value string) resource.TestCheckFunc

CheckListContains checks whether a state list or set contains a given value

func CheckMySQLDatabaseExists

func CheckMySQLDatabaseExists(name string, db *linodego.MySQLDatabase) resource.TestCheckFunc

func CheckPostgresDatabaseExists

func CheckPostgresDatabaseExists(name string, db *linodego.PostgresDatabase) resource.TestCheckFunc

func CheckResourceAttrContains

func CheckResourceAttrContains(resName string, path, desiredValue string) resource.TestCheckFunc

func CheckResourceAttrGreaterThan

func CheckResourceAttrGreaterThan(resName, path string, target int) resource.TestCheckFunc

func CheckResourceAttrListContains

func CheckResourceAttrListContains(resName, path, desiredValue string) resource.TestCheckFunc

func CheckResourceAttrNotEqual

func CheckResourceAttrNotEqual(resName string, path, notValue string) resource.TestCheckFunc

func CheckVolumeDestroy

func CheckVolumeDestroy(s *terraform.State) error

func CheckVolumeExists

func CheckVolumeExists(name string, volume *linodego.Volume) resource.TestCheckFunc

func CreateTempFile

func CreateTempFile(t *testing.T, name, content string) *os.File

func CreateTestProvider

func CreateTestProvider() (*schema.Provider, map[string]*schema.Provider)

func ExecuteTemplate

func ExecuteTemplate(t *testing.T, templateName string, data interface{}) string

func GetRandomOBJCluster

func GetRandomOBJCluster() (string, error)

GetRandomOBJCluster gets a random Object Storage cluster.

func GetRandomRegionWithCaps

func GetRandomRegionWithCaps(capabilities []string, filters ...RegionFilterFunc) (string, error)

GetRandomRegionWithCaps gets a random region given a list of region capabilities.

func GetRegionsWithCaps

func GetRegionsWithCaps(capabilities []string, filters ...RegionFilterFunc) ([]string, error)

GetRegionsWithCaps returns a list of regions that support the given capabilities.

func GetSSHClient

func GetSSHClient(t *testing.T, user, addr string) (client *ssh.Client)

func GetTestClient

func GetTestClient() (*linodego.Client, error)

func LongRunningTest

func LongRunningTest(t *testing.T)

func LoopThroughStringList

func LoopThroughStringList(resName, path string, listValidateFunc ListAttrValidateFunc) resource.TestCheckFunc

func ModifyProviderMeta

func ModifyProviderMeta(provider *schema.Provider, modifier ProviderMetaModifier)

func OptInTest

func OptInTest(t *testing.T)

func PreCheck

func PreCheck(t *testing.T)

func RunTestRetry

func RunTestRetry(t *testing.T, maxAttempts int, f func(t *TRetry))

RunTestRetry attempts to retry the given test if an intermittent error occurs. This function wraps the given testing.T and handles errors accordingly. This should only be used for flapping API tests.

func ShouldSweep

func ShouldSweep(prefix, name string) bool

func SweeperListOptions

func SweeperListOptions(prefix, field string) *linodego.ListOptions

func TestMain

func TestMain(m *testing.M)

func TestProvider

func TestProvider(t *testing.T)

func ValidateResourceAttr

func ValidateResourceAttr(resName, path string, comparisonFunc AttrValidateFunc) resource.TestCheckFunc

Types

type AttrValidateFunc

type AttrValidateFunc func(val string) error

type ListAttrValidateFunc

type ListAttrValidateFunc func(resourceName, path string, state *terraform.State) error

type ProviderMetaModifier

type ProviderMetaModifier func(ctx context.Context, config *helper.ProviderMeta) error

type RegionFilterFunc added in v2.13.0

type RegionFilterFunc func(v linodego.Region) bool

type TRetry

type TRetry struct {
	ErrorChannel   chan error
	SuccessChannel chan bool
	// contains filtered or unexported fields
}

TRetry implements testing.T with additional retry logic

func NewTRetry

func NewTRetry(t *testing.T) *TRetry

func (*TRetry) Cleanup

func (t *TRetry) Cleanup(f func())

func (*TRetry) Close

func (t *TRetry) Close()

func (*TRetry) Error

func (t *TRetry) Error(args ...any)

func (*TRetry) Errorf

func (t *TRetry) Errorf(format string, args ...any)

func (*TRetry) Fail

func (t *TRetry) Fail()

func (*TRetry) FailNow

func (t *TRetry) FailNow()

func (*TRetry) Failed

func (t *TRetry) Failed() bool

func (*TRetry) Fatal

func (t *TRetry) Fatal(args ...any)

func (*TRetry) Fatalf

func (t *TRetry) Fatalf(format string, args ...any)

func (*TRetry) Helper

func (t *TRetry) Helper()

func (*TRetry) Log

func (t *TRetry) Log(args ...any)

func (*TRetry) Logf

func (t *TRetry) Logf(format string, args ...any)

func (*TRetry) Name

func (t *TRetry) Name() string

func (*TRetry) Parallel

func (t *TRetry) Parallel()

func (*TRetry) Setenv

func (t *TRetry) Setenv(key, value string)

func (*TRetry) Skip

func (t *TRetry) Skip(args ...any)

func (*TRetry) SkipNow

func (t *TRetry) SkipNow()

func (*TRetry) Skipf

func (t *TRetry) Skipf(format string, args ...any)

func (*TRetry) Skipped

func (t *TRetry) Skipped() bool

func (*TRetry) TempDir

func (t *TRetry) TempDir() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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