test

package
v1.2.9-prerelease7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	schema.SchemaClient
	CreateDatabase(name string) error
	DropDatabase(name string) error
	ListTables() ([]string, error)
}

DB is a test interface for a database that supports schema tool

type DBTestBase

type DBTestBase struct {
	suite.Suite
	*require.Assertions
	Log    log.Logger
	DBName string
	// contains filtered or unexported fields
}

DBTestBase is the base for all test suites that test the functionality of a DB implementation

func (*DBTestBase) RunCreateTest

func (tb *DBTestBase) RunCreateTest(db DB)

RunCreateTest tests schema version table creation

func (*DBTestBase) RunDropTest

func (tb *DBTestBase) RunDropTest(db DB)

RunDropTest tests the drop methods in DB implementation

func (*DBTestBase) RunParseFileTest

func (tb *DBTestBase) RunParseFileTest(content string)

RunParseFileTest runs a test against the ParseFile method

func (*DBTestBase) RunUpdateTest

func (tb *DBTestBase) RunUpdateTest(db DB)

RunUpdateTest tests update of schema and schema version tables

func (*DBTestBase) SetupSuiteBase

func (tb *DBTestBase) SetupSuiteBase(db DB)

SetupSuiteBase sets up the test suite

func (*DBTestBase) TearDownSuiteBase

func (tb *DBTestBase) TearDownSuiteBase()

TearDownSuiteBase tears down the test suite

type SetupSchemaTestBase

type SetupSchemaTestBase struct {
	suite.Suite
	*require.Assertions

	Log    log.Logger
	DBName string
	// contains filtered or unexported fields
}

SetupSchemaTestBase is the base test suite for all tests that exercise schema setup using the schema tool

func (*SetupSchemaTestBase) RunSetupTest

func (tb *SetupSchemaTestBase) RunSetupTest(
	app *cli.App, db DB, dbNameFlag string, sqlFileContent string, expectedTables []string)

RunSetupTest exercises the SetupSchema task

func (*SetupSchemaTestBase) SetupSuiteBase

func (tb *SetupSchemaTestBase) SetupSuiteBase(db DB)

SetupSuiteBase sets up the test suite

func (*SetupSchemaTestBase) TearDownSuiteBase

func (tb *SetupSchemaTestBase) TearDownSuiteBase()

TearDownSuiteBase tears down the test suite

type UpdateSchemaTestBase

type UpdateSchemaTestBase struct {
	suite.Suite
	*require.Assertions

	Log    log.Logger
	DBName string
	// contains filtered or unexported fields
}

UpdateSchemaTestBase is the base test suite for all tests that exercise schema update using the schema tool

func (*UpdateSchemaTestBase) RunDryrunTest

func (tb *UpdateSchemaTestBase) RunDryrunTest(app *cli.App, db DB, dbNameFlag string, dir string, endVersion string)

RunDryrunTest tests a dryrun schema setup & update

func (*UpdateSchemaTestBase) RunShortcutTest added in v0.13.0

func (tb *UpdateSchemaTestBase) RunShortcutTest(app *cli.App, db DB, dbNameFlag string, dir string, schemaCmd string, schemaCmdArgs ...string)

RunShortcutTest checks that shortcut changes match incremental changes

func (*UpdateSchemaTestBase) RunUpdateSchemaTest

func (tb *UpdateSchemaTestBase) RunUpdateSchemaTest(app *cli.App, db DB, dbNameFlag string, sqlFileContent string, expectedTables []string)

RunUpdateSchemaTest tests schema update

func (*UpdateSchemaTestBase) SetupSuiteBase

func (tb *UpdateSchemaTestBase) SetupSuiteBase(db DB)

SetupSuiteBase sets up the test suite

func (*UpdateSchemaTestBase) TearDownSuiteBase

func (tb *UpdateSchemaTestBase) TearDownSuiteBase()

TearDownSuiteBase tears down the test suite

Jump to

Keyboard shortcuts

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