Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTestDatabase(name string) (string, error)
- func DBNameForFunc(depth int) string
- func ErrToStr(err error) string
- func LoadFixtures(fixturesDir string) error
- func PrepareDatabaseLocal(fixturesPath string, ...) (api.VulcanitoStore, error)
- func PrepareKafka(topics map[string]string) (map[string]string, error)
- func SetupDB(dbDirPath string) error
Constants ¶
const ( TestDBName = "vulcanito_test" TestDBUser = "vulcanito_test" TestDBPassword = "vulcanito_test" DBdialect = "postgres" )
const KafkaTestBroker = "localhost:29092"
KafkaTestBroker contains the address of the local broker used for tests.
Variables ¶
var (
TestDBconnString = fmt.Sprintf("user=%s password=%s sslmode=disable dbname=%s", TestDBUser, TestDBPassword, TestDBName)
)
Functions ¶
func CreateTestDatabase ¶ added in v1.1.4
CreateTestDatabase builds an empty database in the default local test server. The name of the DB will be "vulcanito_<name>_test", where <name> corresponds to the name of the function calling this one.
func DBNameForFunc ¶ added in v1.1.4
DBNameForFunc creates the name of a test DB for a function that is calling this one the number of levels above in the calling tree equal to the specified depth. For instance if a function named FuncA calls function, called FuncB that in turn makes the following call: DBNameForFunc(2), this function will return the following name: vulcanito_FuncA_test.
func PrepareDatabaseLocal ¶
func PrepareDatabaseLocal(fixturesPath string, f func(pDialect, connectionString string, logger log.Logger, logMode bool, defaults map[string][]string) (api.VulcanitoStore, error)) (api.VulcanitoStore, error)
PrepareDatabaseLocal creates a new local test database for the calling function and populates it the fixtures in the specified path.
func PrepareKafka ¶ added in v1.1.4
PrepareKafka creates a new empty topic in the local test Kafka server for each topic name present in topics maps. The name of the topics created will have the following shape: <calling_function_name>_<original_topic_name>_test. It returns a new map with the entities remapped to new topics created.
Types ¶
This section is empty.