acctests

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const WaitDuration = 500 * time.Millisecond

Variables

View Source
var (
	ErrResourceIDNotSet         = errors.New("id not set")
	ErrResourceNotFound         = errors.New("resource not found")
	ErrResourceStillPresent     = errors.New("resource still present")
	ErrResourceFoundInState     = errors.New("this resource should not be here")
	ErrUnknownResourceType      = errors.New("unknown resource type")
	ErrClientNotInited          = errors.New("meta client not inited")
	ErrSecurityPoliciesNotFound = errors.New("security policies not found")
)
View Source
var ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
	"twingate": func() (tfprotov6.ProviderServer, error) {
		upgradedSdkProvider, err := tf5to6server.UpgradeServer(context.Background(), twingate.Provider("test").GRPCProvider)
		if err != nil {
			log.Fatal(err)
		}

		providers := []func() tfprotov6.ProviderServer{
			func() tfprotov6.ProviderServer {
				return upgradedSdkProvider
			},
			providerserver.NewProtocol6(twingateV2.New("test")()),
		}

		provider, err := tf6muxserver.NewMuxServer(context.Background(), providers...)
		if err != nil {
			return nil, fmt.Errorf("failed to run mux server: %w", err)
		}

		return provider, nil
	},
}

Functions

func AddGroupUser added in v0.3.3

func AddGroupUser(groupResource, groupName, terraformUserID string) sdk.TestCheckFunc

func AddResourceGroup added in v0.3.0

func AddResourceGroup(resourceName, groupName string) sdk.TestCheckFunc

func AddResourceServiceAccount added in v0.3.0

func AddResourceServiceAccount(resourceName, serviceAccountName string) sdk.TestCheckFunc

func CheckGroupUsersLen added in v0.3.3

func CheckGroupUsersLen(resourceName string, expectedUsersLen int) sdk.TestCheckFunc

func CheckImportState

func CheckImportState(attributes map[string]string) func(data []*terraform.InstanceState) error

func CheckResourceActiveState added in v1.2.6

func CheckResourceActiveState(resourceAddress string, activeState bool) plancheck.PlanCheck

func CheckResourceGroupsLen added in v0.3.0

func CheckResourceGroupsLen(resourceName string, expectedGroupsLen int) sdk.TestCheckFunc

func CheckResourceSecurityPolicy added in v1.2.5

func CheckResourceSecurityPolicy(resourceName string, expectedSecurityPolicyID string) sdk.TestCheckFunc

func CheckResourceServiceAccountsLen added in v0.3.0

func CheckResourceServiceAccountsLen(resourceName string, expectedServiceAccountsLen int) sdk.TestCheckFunc

func CheckTwingateConnectorAndRemoteNetworkDestroy added in v1.2.2

func CheckTwingateConnectorAndRemoteNetworkDestroy(s *terraform.State) error

func CheckTwingateConnectorDestroy

func CheckTwingateConnectorDestroy(s *terraform.State) error

func CheckTwingateConnectorTokensInvalidated added in v1.2.2

func CheckTwingateConnectorTokensInvalidated(s *terraform.State) error

func CheckTwingateGroupDestroy

func CheckTwingateGroupDestroy(s *terraform.State) error

func CheckTwingateRemoteNetworkDestroy

func CheckTwingateRemoteNetworkDestroy(s *terraform.State) error

func CheckTwingateResourceActiveState

func CheckTwingateResourceActiveState(resourceName string, expectedActiveState bool) sdk.TestCheckFunc

func CheckTwingateResourceDestroy

func CheckTwingateResourceDestroy(s *terraform.State) error

func CheckTwingateResourceDoesNotExists

func CheckTwingateResourceDoesNotExists(resourceName string) sdk.TestCheckFunc

func CheckTwingateResourceExists

func CheckTwingateResourceExists(resourceName string) sdk.TestCheckFunc

func CheckTwingateServiceAccountDestroy

func CheckTwingateServiceAccountDestroy(s *terraform.State) error

func CheckTwingateServiceKeyStatus

func CheckTwingateServiceKeyStatus(resourceName string, expectedStatus string) sdk.TestCheckFunc

func CheckTwingateUserDestroy added in v1.1.0

func CheckTwingateUserDestroy(s *terraform.State) error

func ComposeTestCheckFunc

func ComposeTestCheckFunc(checkFuncs ...sdk.TestCheckFunc) sdk.TestCheckFunc

func DeactivateTwingateResource

func DeactivateTwingateResource(resourceName string) sdk.TestCheckFunc

func DeleteGroupUser added in v0.3.3

func DeleteGroupUser(groupResource, terraformUserID string) sdk.TestCheckFunc

func DeleteResourceGroup added in v0.3.0

func DeleteResourceGroup(resourceName, groupName string) sdk.TestCheckFunc

func DeleteResourceServiceAccount added in v0.3.0

func DeleteResourceServiceAccount(resourceName, serviceAccountName string) sdk.TestCheckFunc

func DeleteTwingateResource

func DeleteTwingateResource(resourceName, resourceType string) sdk.TestCheckFunc

func ErrGroupsLenMismatch added in v0.3.0

func ErrGroupsLenMismatch(expected, actual int) error

func ErrServiceAccountsLenMismatch added in v0.3.0

func ErrServiceAccountsLenMismatch(expected, actual int) error

func ErrUsersLenMismatch added in v0.3.3

func ErrUsersLenMismatch(expected, actual int) error

func GetTestUser added in v1.2.2

func GetTestUser() (*model.User, error)

func GetTestUsers added in v0.3.3

func GetTestUsers() ([]*model.User, error)

func GetTwingateResourceID added in v1.2.2

func GetTwingateResourceID(resourceName string, resourceID **string) sdk.TestCheckFunc

func ListSecurityPolicies added in v0.2.4

func ListSecurityPolicies() ([]*model.SecurityPolicy, error)

func PreCheck

func PreCheck(t *testing.T)

func ResourceName

func ResourceName(resource, name string) string

func RevokeTwingateServiceKey

func RevokeTwingateServiceKey(resourceName string) sdk.TestCheckFunc

func SetPageLimit added in v1.1.0

func SetPageLimit(limit int)

func TerraformConnector

func TerraformConnector(name string) string

func TerraformConnectorTokens

func TerraformConnectorTokens(name string) string

func TerraformGroup

func TerraformGroup(name string) string

func TerraformRemoteNetwork

func TerraformRemoteNetwork(name string) string

func TerraformResource

func TerraformResource(name string) string

func TerraformServiceAccount

func TerraformServiceAccount(name string) string

func TerraformServiceKey

func TerraformServiceKey(name string) string

func TerraformUser added in v1.1.0

func TerraformUser(name string) string

func UpdateResourceSecurityPolicy added in v1.2.5

func UpdateResourceSecurityPolicy(resourceName, securityPolicyID string) sdk.TestCheckFunc

func WaitTestFunc

func WaitTestFunc() sdk.TestCheckFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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