Documentation ¶
Index ¶
- func FindTCPPort(c *gc.C) int
- type ControllerSuite
- func (s *ControllerSuite) ApplyControllerDDL(c *gc.C, db *sql.DB)
- func (s *ControllerSuite) DB() *sql.DB
- func (s *ControllerSuite) NewCleanDB(c *gc.C) *sql.DB
- func (s *ControllerSuite) SetUpTest(c *gc.C)
- func (s *ControllerSuite) TearDownTest(c *gc.C)
- func (s *ControllerSuite) TrackedDB() coredatabase.TrackedDB
- type DBSuite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindTCPPort ¶
FindTCPPort finds an unused TCP port and returns it. It is prone to racing, so the port should be used as soon as it is acquired to minimise the change of another process using it in the interim. The chances of this should be negligible during testing.
Types ¶
type ControllerSuite ¶
type ControllerSuite struct { testing.IsolationSuite // contains filtered or unexported fields }
ControllerSuite is used to provide an in-memory sql.DB reference to tests. It is pre-populated with the controller schema.
func (*ControllerSuite) ApplyControllerDDL ¶
func (s *ControllerSuite) ApplyControllerDDL(c *gc.C, db *sql.DB)
ApplyControllerDDL applies the controller schema to the provided sql.DB. This is useful for tests that need to apply the schema to a new DB.
func (*ControllerSuite) NewCleanDB ¶
func (s *ControllerSuite) NewCleanDB(c *gc.C) *sql.DB
NewCleanDB returns a new sql.DB reference.
func (*ControllerSuite) SetUpTest ¶
func (s *ControllerSuite) SetUpTest(c *gc.C)
SetUpTest creates a new sql.DB reference and ensures that the controller schema is applied successfully.
func (*ControllerSuite) TearDownTest ¶
func (s *ControllerSuite) TearDownTest(c *gc.C)
func (*ControllerSuite) TrackedDB ¶
func (s *ControllerSuite) TrackedDB() coredatabase.TrackedDB
TrackedDB returns a TrackedDB reference.
type DBSuite ¶
type DBSuite struct { testing.IsolationSuite // contains filtered or unexported fields }
DBSuite is used to provide a Dqlite-backed sql.DB reference to tests.
func (*DBSuite) SetUpSuite ¶
SetUpSuite creates a new Dqlite application and waits for it to be ready.
func (*DBSuite) SetUpTest ¶
SetUpTest opens a new, randomly named database and makes it available for use by test the next test.
func (*DBSuite) TearDownSuite ¶
TearDownSuite terminates the Dqlite node, releasing all resources.
func (*DBSuite) TearDownTest ¶
TearDownTest closes the database opened in SetUpTest. TODO (manadart 2022-09-12): There is currently no avenue for dropping a DB.
func (*DBSuite) TrackedDB ¶
func (s *DBSuite) TrackedDB() coredatabase.TrackedDB