Browse Source

fix golint

pull/304/head
yedf2 4 years ago
parent
commit
2d52f5369b
  1. 8
      dtmsvr/storage/sql/sql.go
  2. 15
      test/main_test.go

8
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")
}

15
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

Loading…
Cancel
Save