@ -197,6 +197,9 @@ func checkConfig() string {
func WaitDBUp() {
sdb, err := dtmimp.StandaloneDB(DtmConfig.DB)
dtmimp.FatalIfError(err)
defer func() {
sdb.Close()
}()
for _, err := dtmimp.DBExec(sdb, "select 1"); err != nil; { // wait for mysql to start
time.Sleep(3 * time.Second)
_, err = dtmimp.DBExec(sdb, "select 1")
@ -19,6 +19,10 @@ func TestDb(t *testing.T) {
assert.NotEqual(t, nil, err)
}
func TestWaitDBUp(t *testing.T) {
WaitDBUp()
func TestDbAlone(t *testing.T) {
db, err := dtmimp.StandaloneDB(DtmConfig.DB)
assert.Nil(t, err)