test

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectParams added in v1.2.0

type ConnectParams struct {
	Host     string
	Port     string
	User     string
	Password string
}

ConnectParams holds connection parameters for CLI tool invocations in tests. Empty fields are omitted from the command line, allowing the CLI defaults to apply.

func (ConnectParams) CLIFlags added in v1.2.0

func (p ConnectParams) CLIFlags() []string

CLIFlags returns the CLI flags for the connection parameters.

type DB

type DB interface {
	schema.DB
	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

	Logger 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, pluginName string, conn ConnectParams)

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

	Logger 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) 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, pluginName string, conn ConnectParams)

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