testing

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MPL-2.0 Imports: 21 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelperTestView added in v0.10.7

func HelperTestView(t *testing.T, resource ViewTestCase)

func TestResource

func TestResource(t *testing.T, resource ResourceTestCase)

Types

type ResourceTestCase added in v0.6.0

type ResourceTestCase struct {
	Provider *provider.Provider
	Config   string
	// we want it to be parallel by default
	NotParallel bool
	// ParallelFetchingLimit limits parallel resources fetch at a time
	ParallelFetchingLimit uint64
	// SkipIgnoreInTest flag which detects if schema.Table or schema.Column should be ignored
	SkipIgnoreInTest bool
	// Verifiers are map from resource name to its verifiers.
	// If no verifiers specified for resource (resource name is not in key set of map),
	// non emptiness check of all columns in table and its relations will be performed.
	Verifiers map[string][]Verifier
}

type Row added in v0.8.19

type Row map[string]interface{}

type Verifier added in v0.8.19

type Verifier func(t *testing.T, table *schema.Table, conn pgxscan.Querier, shouldSkipIgnoreInTest bool)

Verifier verifies tables specified by table schema (main table and its relations).

func VerifyAtLeastOneRow added in v0.8.19

func VerifyAtLeastOneRow() Verifier

VerifyAtLeastOneRow verifies that main table from schema has at least one row

func VerifyAtMostOneOf added in v0.8.19

func VerifyAtMostOneOf(tableName string, oneof ...string) Verifier

VerifyAtMostOneOf verifies that for each row in table at most one column from oneof is not empty

func VerifyNoEmptyColumnsExcept added in v0.8.19

func VerifyNoEmptyColumnsExcept(tableName string, except ...string) Verifier

VerifyNoEmptyColumnsExcept verifies that for each row in table its columns are not empty except passed

func VerifyRowPredicateInTable added in v0.8.19

func VerifyRowPredicateInTable(tableName string, rowVerifier func(*testing.T, Row)) Verifier

VerifyRowPredicateInTable is a base verifier accepting single row verifier for specific table from schema

type ViewTestCase added in v0.10.7

type ViewTestCase struct {
	// Provider to configure and create tables before executing the view
	Provider *provider.Provider
	// SQLView statement that create that view
	SQLView string
}

Jump to

Keyboard shortcuts

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