dao_test.go 650 B

1234567891011121314151617181920212223242526272829303132
  1. package dao
  2. import (
  3. "flag"
  4. "os"
  5. "testing"
  6. "go-common/app/interface/main/dm/conf"
  7. "go-common/library/log"
  8. )
  9. var testDao *Dao
  10. func TestMain(m *testing.M) {
  11. flag.Set("app_id", "main.community.dm")
  12. flag.Set("conf_token", "4d343dc5d8c33460156baec8913eb64a")
  13. flag.Set("tree_id", "2692")
  14. flag.Set("conf_version", "docker-1")
  15. flag.Set("deploy_env", "uat")
  16. flag.Set("conf_host", "config.bilibili.co")
  17. flag.Set("conf_path", "/tmp")
  18. flag.Set("region", "sh")
  19. flag.Set("zone", "sh001")
  20. flag.Parse()
  21. if err := conf.Init(); err != nil {
  22. panic(err)
  23. }
  24. log.Init(conf.Conf.Xlog)
  25. defer log.Close()
  26. testDao = New(conf.Conf)
  27. os.Exit(m.Run())
  28. }