testutil

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnusedAPIKey = "foo"
)

Variables

This section is empty.

Functions

func CreateTemp

func CreateTemp(body string) (string, func(), error)

CreateTemp creates a temporary file with body and returns the path and the cleanup callback.

func IntegrationTest

func IntegrationTest(t *testing.T, conf IntegrationTestConfig, c resource.TestCase)

func IsConnectableWithAdminPassword

func IsConnectableWithAdminPassword(adminPassword string) resource.CheckResourceAttrWithFunc

IsConnectableWithAdminPassword attempts to connect to the workspace and execute a sample SQL query.

func MustJSON

func MustJSON(s interface{}) []byte

func UnitTest

func UnitTest(t *testing.T, conf UnitTestConfig, c resource.TestCase)

UnitTest is a helper around resource.UnitTest with provider factories already configured.

Types

type AttributeSetter

type AttributeSetter func(name string, val cty.Value) UpdatableConfig

AttributeSetter is a type for setting an hcl attribute for a provider, data source, or resource.

type IntegrationTestConfig

type IntegrationTestConfig struct {
	APIKey             string
	WorkspaceGroupName string
}

type UnitTestConfig

type UnitTestConfig struct {
	APIKeyFromEnv string
	APIKey        string
	APIServiceURL string
}

type UpdatableConfig

type UpdatableConfig string

UpdatableConfig is the convenience for updating the config example for tests.

func (UpdatableConfig) String

func (uc UpdatableConfig) String() string

String shows the result.

func (UpdatableConfig) WithAPIKey

func (uc UpdatableConfig) WithAPIKey(apiKey string) UpdatableConfig

WithAPIKey extends the config with the API key if the key is not empty.

func (UpdatableConfig) WithAPIKeyPath

func (uc UpdatableConfig) WithAPIKeyPath(apiKeyPath string) UpdatableConfig

WithAPIKeyPath extends the config with the API key path.

func (UpdatableConfig) WithAPIServiceURL

func (uc UpdatableConfig) WithAPIServiceURL(url string) UpdatableConfig

WithAPIKey extends the config with the API service url if the url is not empty.

func (UpdatableConfig) WithWorkspaceGetDataSource

func (uc UpdatableConfig) WithWorkspaceGetDataSource(workspaceName string) AttributeSetter

func (UpdatableConfig) WithWorkspaceGroupGetDataSoure

func (uc UpdatableConfig) WithWorkspaceGroupGetDataSoure(workspaceGroupName string) AttributeSetter

func (UpdatableConfig) WithWorkspaceGroupResource

func (uc UpdatableConfig) WithWorkspaceGroupResource(workspaceGroupName string) AttributeSetter

func (UpdatableConfig) WithWorkspaceListDataSoure

func (uc UpdatableConfig) WithWorkspaceListDataSoure(workspaceListName string) AttributeSetter

func (UpdatableConfig) WithWorkspaceResource

func (uc UpdatableConfig) WithWorkspaceResource(workspaceName string) AttributeSetter

Jump to

Keyboard shortcuts

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