acctest

package
v0.98.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
	"hcp": func() (tfprotov6.ProviderServer, error) {
		providers := []func() tfprotov6.ProviderServer{
			providerserver.NewProtocol6(provider.NewFrameworkProvider(version.ProviderVersion)()),
		}

		return tf6muxserver.NewMuxServer(context.Background(), providers...)
	},
}

ProtoV6ProviderFactories provides a Provider Factory to be used within acceptance tests.

Functions

func CheckDataSourceStateMatchesResourceStateWithIgnores

func CheckDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, resourceName string, ignoreFields map[string]struct{}) resource.TestCheckFunc

CheckDataSourceStateMatchesResourceStateWithIgnores returns a resource.TestCheckFunc that compares the state of a data source to that of a resource. For example, an acceptance test can use the following config:

resource "hcp_project" "project" {
  name        = %q
  description = %q
}

data "hcp_project" "project" {
  project = hcp_project.project.resource_id
}

Then the following check can be defined:

  CheckDataSourceStateMatchesResourceStateWithIgnores(
	 "data.hcp_project.project",
     "hcp_project.project",
      map[string]struct{}{"project": {}}),
  )

func DefaultProjectLocation added in v0.81.1

func DefaultProjectLocation(t *testing.T) location.Location

func HCPClients

func HCPClients(t *testing.T) *clients.Client

HCPClients returns the clients from the test provider.

func PreCheck

func PreCheck(t *testing.T)

PreCheck verifies that the required provider testing configuration is set.

This PreCheck function should be present in every acceptance test. It ensures credentials and other test environment settings are configured.

func RandString

func RandString(length int) string

RandString generates a random string with the given length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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