acctest

package
v0.0.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Integration test account ID.
	TestAccCloudflareAccountID string = "f037e56e89293a057740de681ac9abbe"

	// Integration test account zone ID.
	TestAccCloudflareZoneID string = "0da42c8d2132a9ddaf714f9e7c920711"
	// Integration test account zone name.
	TestAccCloudflareZoneName string = "terraform.cfapi.net"

	// Integration test account alternate zone ID.
	TestAccCloudflareAltZoneID string = "b72110c08e3382597095c29ba7e661ea"
	// Integration test account alternate zone name.
	TestAccCloudflareAltZoneName string = "terraform2.cfapi.net"
)
View Source
var TestAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
	"cloudflare-extended": func() (tfprotov6.ProviderServer, error) {
		return providerserver.NewProtocol6(provider.New("dev")())(), nil
	},
}

Functions

func DumpState

func DumpState(s *terraform.State) error

DumpState returns the state representation of the resource for inspection inside of a `resource.TestCase`.

Example:

resource.Test(t, resource.TestCase{
	PreCheck:                 func() { acctest.TestAccPreCheck(t) },
	ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories,
	Steps: []resource.TestStep{
		{
			Config: myConfig(),
			Check: resource.ComposeTestCheckFunc(
				acctest.DumpState,
				resource.TestCheckResourceAttr(resourceID, consts.ZoneIDSchemaKey, zoneID),
			),
		},
	},
})

Returns the resource, identifier and attributes all keyed to the value.

cloudflare_foo.bar.id = 4dd549e6d9b22cdac402b33af89d57ab
cloudflare_foo.bar.other_thing = true
cloudflare_foo.bar.zone_id = 0da42c8d2132a9ddaf714f9e7c920711
cloudflare_foo.bar.% = 12

func LoadTestCase

func LoadTestCase(filename string, parameters ...interface{}) string

LoadTestCase takes a filename and variadic parameters to build test case output.

Example: If you have a "basic" test case that for `r2_bucket` resource, inside of the `testdata` directory, you need to have a `basic.tf` file.

  $ tree internal/services/r2_bucket/
  ├── ...
  ├── schema.go
  └── testdata
	  └── basic.tf

The invocation would be `LoadTestCase("basic.tf", rnd, acountID)`.

func SharedClient

func SharedClient() *cloudflare.Client

SharedClient returns a common Cloudflare V2 client setup needed for the sweeper functions.

func SharedV1Client

func SharedV1Client() (*cfv1.API, error)

SharedV1Client returns a common Cloudflare V1 client setup needed for the sweeper functions.

func TestAccPreCheck

func TestAccPreCheck(t *testing.T)

func TestAccPreCheck_APIKey

func TestAccPreCheck_APIKey(t *testing.T)

Test helper method checking `CLOUDFLARE_API_KEY` is present.

func TestAccPreCheck_APIToken

func TestAccPreCheck_APIToken(t *testing.T)

Test helper method checking `CLOUDFLARE_API_TOKEN` is present.

func TestAccPreCheck_AccountID

func TestAccPreCheck_AccountID(t *testing.T)

Test helper method checking `CLOUDFLARE_ACCOUNT_ID` is present.

func TestAccPreCheck_AlternateDomain

func TestAccPreCheck_AlternateDomain(t *testing.T)

Test helper method checking `CLOUDFLARE_ALT_DOMAIN` is present.

func TestAccPreCheck_AlternateZoneID

func TestAccPreCheck_AlternateZoneID(t *testing.T)

Test helper method checking `CLOUDFLARE_ALT_ZONE_ID` is present.

func TestAccPreCheck_BYOIPPrefix

func TestAccPreCheck_BYOIPPrefix(t *testing.T)

Test helper method checking `CLOUDFLARE_BYO_IP_PREFIX_ID` is present.

func TestAccPreCheck_Credentials

func TestAccPreCheck_Credentials(t *testing.T)

func TestAccPreCheck_Domain

func TestAccPreCheck_Domain(t *testing.T)

Test helper method checking `CLOUDFLARE_DOMAIN` is present.

func TestAccPreCheck_Email

func TestAccPreCheck_Email(t *testing.T)

Test helper method checking `CLOUDFLARE_EMAIL` is present.

func TestAccPreCheck_Hyperdrive

func TestAccPreCheck_Hyperdrive(t *testing.T)

Test helper method checking all required Hyperdrive configurations are present.

func TestAccPreCheck_HyperdriveWithAccess

func TestAccPreCheck_HyperdriveWithAccess(t *testing.T)

func TestAccPreCheck_LogpushToken

func TestAccPreCheck_LogpushToken(t *testing.T)

Test helper method checking `CLOUDFLARE_LOGPUSH_OWNERSHIP_TOKEN` is present.

func TestAccPreCheck_Pages

func TestAccPreCheck_Pages(t *testing.T)

Test helper method checking the required environment variables for Cloudflare Pages are present.

func TestAccPreCheck_WorkspaceOne

func TestAccPreCheck_WorkspaceOne(t *testing.T)

Test helper method checking the Workspace One environment variables are present.

func TestAccPreCheck_ZoneID

func TestAccPreCheck_ZoneID(t *testing.T)

Test helper method checking `CLOUDFLARE_ZONE_ID` is present.

func TestAccSkipForDefaultAccount

func TestAccSkipForDefaultAccount(t *testing.T, reason string)

TestAccSkipForDefaultAccount is used for skipping over tests that are not run by default on usual acceptance test suite account.

func TestAccSkipForDefaultZone

func TestAccSkipForDefaultZone(t *testing.T, reason string)

TestAccSkipForDefaultZone is used for skipping over tests that are not run by default on usual acceptance test suite account.

Types

This section is empty.

Jump to

Keyboard shortcuts

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