dao_test.go 792 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dao
  2. import (
  3. "flag"
  4. "os"
  5. "testing"
  6. "go-common/app/interface/main/answer/conf"
  7. )
  8. var (
  9. d *Dao
  10. mid int64 = 7593623
  11. )
  12. func TestMain(m *testing.M) {
  13. if os.Getenv("DEPLOY_ENV") != "" {
  14. flag.Set("app_id", "main.account-law.answer")
  15. flag.Set("conf_appid", "main.account-law.answer")
  16. flag.Set("conf_token", "ba3ee255695e8d7b46782268ddc9c8a3")
  17. flag.Set("tree_id", "25260")
  18. flag.Set("conf_version", "docker-1")
  19. flag.Set("deploy_env", "uat")
  20. flag.Set("conf_env", "10")
  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. } else {
  26. flag.Set("conf", "../cmd/answer-test.toml")
  27. }
  28. flag.Parse()
  29. if err := conf.Init(); err != nil {
  30. panic(err)
  31. }
  32. d = New(conf.Conf)
  33. os.Exit(m.Run())
  34. }