qa

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertErrorStartsWith

func AssertErrorStartsWith(t *testing.T, err error, message string) bool

AssertErrorStartsWith ..

func EnvironmentTemplate

func EnvironmentTemplate(t *testing.T, template string, otherVars ...map[string]string) string

EnvironmentTemplate asserts existence and fills in {env.VAR} & {var.RANDOM} placeholders in template

func FirstKeyValue

func FirstKeyValue(t *testing.T, str, key string) string

FirstKeyValue gets it from HCL string

func GetEnvOrSkipTest

func GetEnvOrSkipTest(t *testing.T, name string) string

GetEnvOrSkipTest proceeds with test only with that env variable

func HttpFixtureClient

func HttpFixtureClient(t *testing.T, fixtures []HTTPFixture) (client *common.DatabricksClient, server *httptest.Server, err error)

HttpFixtureClient creates client for emulated HTTP server

func RandomEmail added in v0.3.0

func RandomEmail() string

RandomEmail generates random email

func RandomLongName

func RandomLongName() string

RandomLongName ...

func RandomName

func RandomName(prefix ...string) string

RandomName gives random name with optional prefix. e.g. qa.RandomName("tf-")

func TestCreateTempFile

func TestCreateTempFile(t *testing.T, data string) string

TestCreateTempFile ...

Types

type HTTPFixture

type HTTPFixture struct {
	Method          string
	Resource        string
	Response        interface{}
	Status          int
	ExpectedRequest interface{}
	ReuseRequest    bool
}

HTTPFixture defines request structure for test

func UnionFixturesLists

func UnionFixturesLists(fixturesLists ...[]HTTPFixture) (fixtureList []HTTPFixture)

UnionFixturesLists merges two HTTP fixture lists together

type ResourceFixture

type ResourceFixture struct {
	Fixtures      []HTTPFixture
	Resource      *schema.Resource
	RequiresNew   bool
	InstanceState map[string]string
	State         map[string]interface{}
	// HCL might be useful to test nested blocks
	HCL         string
	CommandMock common.CommandMock
	Create      bool
	Read        bool
	Update      bool
	Delete      bool
	Removed     bool
	ID          string
	NonWritable bool
	Azure       bool
	// new resource
	New bool
}

ResourceFixture helps testing resources and commands

func (ResourceFixture) Apply

Apply runs tests from fixture

func (ResourceFixture) ApplyNoError added in v0.3.0

func (f ResourceFixture) ApplyNoError(t *testing.T)

ApplyNoError is a convenience method for no-data tests

Jump to

Keyboard shortcuts

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