Documentation ¶
Index ¶
- func AssertErrorStartsWith(t *testing.T, err error, message string) bool
- func EnvironmentTemplate(t *testing.T, template string, otherVars ...map[string]string) string
- func FirstKeyValue(t *testing.T, str, key string) string
- func GetEnvOrSkipTest(t *testing.T, name string) string
- func HttpFixtureClient(t *testing.T, fixtures []HTTPFixture) (client *common.DatabricksClient, server *httptest.Server, err error)
- func RandomEmail() string
- func RandomLongName() string
- func RandomName(prefix ...string) string
- func TestCreateTempFile(t *testing.T, data string) string
- type HTTPFixture
- type ResourceFixture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertErrorStartsWith ¶
AssertErrorStartsWith ..
func EnvironmentTemplate ¶
EnvironmentTemplate asserts existence and fills in {env.VAR} & {var.RANDOM} placeholders in template
func FirstKeyValue ¶
FirstKeyValue gets it from HCL string
func GetEnvOrSkipTest ¶
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 RandomName ¶
RandomName gives random name with optional prefix. e.g. qa.RandomName("tf-")
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 ¶
func (f ResourceFixture) Apply(t *testing.T) (*schema.ResourceData, error)
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
Click to show internal directories.
Click to hide internal directories.