dao_test.go 868 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package block
  2. import (
  3. "flag"
  4. "os"
  5. "testing"
  6. "go-common/app/service/main/member/conf"
  7. "go-common/library/cache/memcache"
  8. "go-common/library/database/sql"
  9. bm "go-common/library/net/http/blademaster"
  10. )
  11. var (
  12. d *Dao
  13. )
  14. func TestMain(m *testing.M) {
  15. if os.Getenv("DEPLOY_ENV") != "" {
  16. flag.Set("app_id", "main.account.member-service")
  17. flag.Set("conf_token", "ef70dbff7ee115ce242c67e633b21c29")
  18. flag.Set("tree_id", "2137")
  19. flag.Set("conf_version", "docker-1")
  20. flag.Set("deploy_env", "uat")
  21. flag.Set("conf_host", "config.bilibili.co")
  22. flag.Set("conf_path", "/tmp")
  23. flag.Set("region", "sh")
  24. flag.Set("zone", "sh001")
  25. }
  26. flag.Parse()
  27. if err := conf.Init(); err != nil {
  28. panic(err)
  29. }
  30. c := conf.Conf
  31. d = New(c,
  32. sql.NewMySQL(c.BlockMySQL),
  33. memcache.NewPool(c.BlockMemcache),
  34. bm.NewClient(c.HTTPClient),
  35. nil,
  36. )
  37. m.Run()
  38. os.Exit(0)
  39. }