diff --git a/dtmsvr/storage/sql/sql.go b/dtmsvr/storage/sql/sql.go index 1a8e657..7ad4cbc 100644 --- a/dtmsvr/storage/sql/sql.go +++ b/dtmsvr/storage/sql/sql.go @@ -195,14 +195,6 @@ func wrapError(err error) error { return err } -func getTime(after time.Duration) string { - second := int64(after / time.Second) - return map[string]string{ - "mysql": fmt.Sprintf("date_add(now(), interval %d second)", second), - "postgres": fmt.Sprintf("current_timestamp + interval '%d second'", second), - }[conf.Store.Driver] -} - func getTimeStr(afterSecond int64) string { return dtmutil.GetNextTime(afterSecond).Format("2006-01-02 15:04:05") } diff --git a/test/main_test.go b/test/main_test.go index a8b7fb1..a9f48d8 100644 --- a/test/main_test.go +++ b/test/main_test.go @@ -40,23 +40,18 @@ func TestMain(m *testing.M) { dtmcli.GetRestyClient().OnAfterResponse(func(c *resty.Client, resp *resty.Response) error { return nil }) tenv := os.Getenv("TEST_STORE") + conf.Store.Host = "localhost" + conf.Store.Driver = tenv if tenv == "boltdb" { - conf.Store.Driver = "boltdb" - } else if tenv == "mysql" { - conf.Store.Driver = "mysql" - conf.Store.Host = "localhost" + } else if tenv == config.Mysql { conf.Store.Port = 3306 conf.Store.User = "root" conf.Store.Password = "" - } else if tenv == "postgres" { - conf.Store.Driver = "postgres" - conf.Store.Host = "localhost" + } else if tenv == config.Postgres { conf.Store.Port = 5432 conf.Store.User = "postgres" conf.Store.Password = "mysecretpassword" - } else { - conf.Store.Driver = "redis" - conf.Store.Host = "localhost" + } else if tenv == config.Redis { conf.Store.User = "" conf.Store.Password = "" conf.Store.Port = 6379