providertest

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntegrationTest added in v0.2.4

func IntegrationTest(t *testing.T, providerCreator func() *provider.Provider, resource ResourceIntegrationTestData)

IntegrationTest - creates resources using terraform, fetches them to db and compares with expected values

func TestResource

func TestResource(t *testing.T, providerCreator func() *provider.Provider, resource ResourceTestData)

Types

type ExpectedValue added in v0.2.4

type ExpectedValue struct {
	Count int                    // expected count of items
	Data  map[string]interface{} // expected data of items
}

ExpectedValue - describes the data that expected to be in database after fetch

type ResourceIntegrationTestData added in v0.2.4

type ResourceIntegrationTestData struct {
	Table               *schema.Table
	Config              interface{}
	Resources           []string
	Configure           func(logger hclog.Logger, data interface{}) (schema.ClientMeta, error)
	Suffix              string
	Prefix              string
	VerificationBuilder func(res *ResourceIntegrationTestData) ResourceIntegrationVerification
	// contains filtered or unexported fields
}

type ResourceIntegrationVerification added in v0.2.4

type ResourceIntegrationVerification struct {
	Name           string
	ForeignKeyName string
	ExpectedValues []ExpectedValue
	Filter         func(sq squirrel.SelectBuilder, res *ResourceIntegrationTestData) squirrel.SelectBuilder
	Relations      []*ResourceIntegrationVerification
}

ResourceIntegrationVerification - a set of verification rules to query and check test related data

type ResourceTestData

type ResourceTestData struct {
	Table          *schema.Table
	Config         interface{}
	Resources      []string
	Configure      func(logger hclog.Logger, data interface{}) (schema.ClientMeta, error)
	SkipEmptyJsonB bool
}

Jump to

Keyboard shortcuts

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