Merged in feature/postprocessing (pull request #114)
Feature/postprocessing * tests * passtest * fixshorttests * mosttests * improvingbasedockerfile * testspeeds * testing * host * canparallel * clean * passfullsuite * singlepagemax * test * findfeatures * findstables * tbls * tablestoo * tablestoo * lateraltests * tableloc * cleanup * inlinetable * childids * cleanup * tests
This commit is contained in:
@@ -25,6 +25,7 @@ type DBConfig struct {
|
||||
type ConfigProvider interface {
|
||||
GetDBBaseURI() string
|
||||
GetDBURI() string
|
||||
GetDBAdminDBURI() string
|
||||
GetDBOpts() map[string]string
|
||||
GetDBOptsString() string
|
||||
GetDBHost() string
|
||||
@@ -82,6 +83,10 @@ func (b *DBConfig) GetDBBaseURI() string {
|
||||
return fmt.Sprintf("%s://%s:%s@%s:%d/", b.GetDBDriver(), b.DBUser, b.DBSecret, b.DBHost, b.DBPort)
|
||||
}
|
||||
|
||||
func (b *DBConfig) GetDBAdminDBURI() string {
|
||||
return fmt.Sprintf("%s%s?%s", b.GetDBBaseURI(), b.GetDBDriver(), b.GetDBOptsString())
|
||||
}
|
||||
|
||||
func (b *DBConfig) GetDBURI() string {
|
||||
return fmt.Sprintf("%s%s?%s", b.GetDBBaseURI(), b.DBName, b.GetDBOptsString())
|
||||
}
|
||||
|
||||
@@ -67,6 +67,22 @@ func TestGetDBURI(t *testing.T) {
|
||||
assert.Equal(t, "postgres://user:pass@host:123/name?sslmode=disable", uri)
|
||||
}
|
||||
|
||||
func TestGetDBAdminDBURI(t *testing.T) {
|
||||
cfg := database.DBConfig{}
|
||||
|
||||
uri := cfg.GetDBURI()
|
||||
assert.Equal(t, "postgres://:@:0/?", uri)
|
||||
|
||||
cfg.DBHost = "host"
|
||||
cfg.DBPort = 123
|
||||
cfg.DBUser = "user"
|
||||
cfg.DBSecret = "pass"
|
||||
cfg.DBName = "name"
|
||||
cfg.DBNoSSL = true
|
||||
uri = cfg.GetDBAdminDBURI()
|
||||
assert.Equal(t, "postgres://user:pass@host:123/postgres?sslmode=disable", uri)
|
||||
}
|
||||
|
||||
func TestGetDBHost(t *testing.T) {
|
||||
cfg := database.DBConfig{}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ func TestSetDBPool(t *testing.T) {
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.SetCfgProvider(t, cfg)
|
||||
_, cleanup := test.CreateDB(t, ctx, cfg, &test.CreateDatabaseConfig{
|
||||
net := test.DepNetwork.Get(t, ctx)
|
||||
_ = test.CreateDB(t, ctx, cfg, net, &test.CreateDatabaseConfig{
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
err := cfg.SetDBPool(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user