testing

package
v0.0.0-...-b9bb202 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpChangeLogState

func DumpChangeLogState(c *gc.C, runner database.TxnRunner)

DumpChangeLogState dumps the change log to the test log.

Types

type ControllerModelSuite

type ControllerModelSuite struct {
	ControllerSuite
}

ControllerModelSuite is used to provide a sql.DB reference for tests that can both be used for controller and model operations and their separate DB requirements.

func (*ControllerModelSuite) ModelTxnRunner

func (s *ControllerModelSuite) ModelTxnRunner(c *gc.C, modelUUID string) coredatabase.TxnRunner

ModelTxnRunner returns a transaction runner on to the model database for the provided model uuid.

type ControllerSuite

type ControllerSuite struct {
	testing.DqliteSuite
}

ControllerSuite is used to provide a sql.DB reference to tests. It is pre-populated with the controller schema.

func (*ControllerSuite) ApplyDDLForRunner

func (s *ControllerSuite) ApplyDDLForRunner(c *gc.C, runner coredatabase.TxnRunner)

ApplyDDLForRunner is responsible for applying the controller schema to the given database.

func (*ControllerSuite) ControllerTxnRunner

func (s *ControllerSuite) ControllerTxnRunner() coredatabase.TxnRunner

ControllerTxnRunner returns a txn runner attached to the controller database.

func (*ControllerSuite) SeedControllerTable

func (s *ControllerSuite) SeedControllerTable(c *gc.C, controllerModelUUID coremodel.UUID) (controllerUUID string)

SeedControllerTable sets the uuid in the controller table to the default testing value and the controller mode uuid to the supplied value. It does not add any other controller config.

func (*ControllerSuite) SeedControllerUUID

func (s *ControllerSuite) SeedControllerUUID(c *gc.C) (controllerUUID string)

func (*ControllerSuite) SetUpTest

func (s *ControllerSuite) SetUpTest(c *gc.C)

SetUpTest is responsible for setting up a testing database suite initialised with the controller schema.

type ModelSuite

type ModelSuite struct {
	testing.DqliteSuite
	// contains filtered or unexported fields
}

ModelSuite is used to provide an in-memory sql.DB reference to tests. It is pre-populated with the model schema.

func (*ModelSuite) ModelTxnRunner

func (s *ModelSuite) ModelTxnRunner() coredatabase.TxnRunner

ModelTxnRunner returns a txn runner attached to the model database.

func (*ModelSuite) ModelUUID

func (s *ModelSuite) ModelUUID() string

func (*ModelSuite) SetUpTest

func (s *ModelSuite) SetUpTest(c *gc.C)

SetUpTest is responsible for setting up a testing database suite initialised with the model schema.

type SchemaApplier

type SchemaApplier struct {
	Schema  *schema.Schema
	Verbose bool
}

SchemaApplier is a helper that applies a schema to a database.

func (*SchemaApplier) Apply

func (s *SchemaApplier) Apply(c *gc.C, ctx context.Context, runner database.TxnRunner)

Apply applies the schema to the database.

Jump to

Keyboard shortcuts

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