Documentation ¶
Overview ¶
The base environment for RDB testing
Flags ¶
This package has pre-defined flags of command:
-dsn_mysql - MySQL DSN used to intialize configuration of mysql connection
Index ¶
- func InitDbFacade(c *check.C) *f.DbFacadedeprecated
- func NewDbConfigByDsn(dsn string) *commonDb.DbConfig
- func NewDbConfigByFlag(dbFlag int) *commonDb.DbConfig
- func ReleaseDbFacade(c *check.C, dbFacade *f.DbFacade)
- func SetupByViableDbConfig(c *check.C, configFunc ViableDbConfigFunc) booldeprecated
- type GinkgoDb
- func (g *GinkgoDb) GetDbConfig() *commonDb.DbConfigdeprecated
- func (g *GinkgoDb) InitDbFacade() *f.DbFacade
- func (g *GinkgoDb) InitDbFacadeByDbConfig(dbConfig *commonDb.DbConfig) *f.DbFacade
- func (g *GinkgoDb) InitDbFacadeByFlag(flag int) *f.DbFacade
- func (g *GinkgoDb) ReleaseDbFacade(dbFacade *f.DbFacade)
- type ViableDbConfigFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDbFacade
deprecated
Constructs "*db/facade/DbFacade" object by configuration of flag.
The checker object is used to trigger panic if the database cannot be opened.
If the environment is not ready(flag is empty), this function returns "nil"
Deprecated: Try to use "flag.SkipFactory"(common/testing/flag) instead
func NewDbConfigByDsn ¶
Initializes a configuration of database by DSN.
If DSN is empty string, this function returns nil pointer.
See "NewDbConfigByFlag(int)"
func NewDbConfigByFlag ¶
Initializes a configuration of database by test flags(OWL database)
For example: flag.OWL_DB_PORTAL
See godoc of "common/testing/flag"
func ReleaseDbFacade ¶
Releases "*db/facade/DbFacade" object by configuration of flag.
The checker object is used to trigger panic if the database cannot be released.
func SetupByViableDbConfig
deprecated
func SetupByViableDbConfig(c *check.C, configFunc ViableDbConfigFunc) bool
This function is used to:
- Checks whether or not the property of "mysql" has been supplied
- If it does, supply the data of configuration to callback function
Deprecated: Try to use "flag.SkipFactory"(common/testing/flag) instead
Types ¶
type GinkgoDb ¶
type GinkgoDb struct{}
Provides some utility functions to ease the construction of database connection for testing.
func (*GinkgoDb) GetDbConfig
deprecated
Constructs "*db/facade/DbFacade" object by default configuration object
To support new property of "flag.OWL_DB_PORTAL", this function checks the flag first or use "flag.F_MySql" for compatibility of old flags.
Deprecated: Since it is possible that a test environment needs multiple connections to different databases,
you should use "*GinkgoDb.InitDbFacadeByFlag" to initialize corresponding databases instead.
func (*GinkgoDb) InitDbFacade ¶
Constructs "*db/facade/DbFacade" object by configuration of flag.
The checker object is used to trigger panic if the database cannot be opened.
If the environment is not ready(flag is empty), this function returns "nil"
func (*GinkgoDb) InitDbFacadeByDbConfig ¶
Constructs "*db/facade/DbFacade" object by configuration object
This function uses "Ginkgo" assertion to ensure that the database connection gets succeeded.
func (*GinkgoDb) InitDbFacadeByFlag ¶
Constructs "*db/facade/DbFacade" object by test flags(OWL database)
For example: flag.OWL_DB_PORTAL
See godoc of "common/testing/flag"
func (*GinkgoDb) ReleaseDbFacade ¶
Releases "*db/facade/DbFacade" object by configuration of flag.
The checker object is used to trigger panic if the database cannot be released.
type ViableDbConfigFunc ¶
This callback is used to setup a viable database configuration for testing.