testing

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MPL-2.0 Imports: 28 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntegrationTest

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

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

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

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