dao_test.go 782 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package dao
  2. import (
  3. "flag"
  4. "os"
  5. "testing"
  6. "go-common/app/service/main/secure/conf"
  7. )
  8. var (
  9. d *Dao
  10. )
  11. func TestMain(m *testing.M) {
  12. if os.Getenv("DEPLOY_ENV") != "" {
  13. flag.Set("app_id", "main.account.secure-service")
  14. flag.Set("conf_appid", "main.account.secure-service")
  15. flag.Set("conf_token", "02bebea2b9e0b8d5b0433b2a59b8bc68")
  16. flag.Set("tree_id", "2864")
  17. flag.Set("conf_version", "docker-1")
  18. flag.Set("deploy_env", "uat")
  19. flag.Set("conf_env", "10")
  20. flag.Set("conf_host", "config.bilibili.co")
  21. flag.Set("conf_path", "/tmp")
  22. flag.Set("region", "sh")
  23. flag.Set("zone", "sh001")
  24. } else {
  25. flag.Set("conf", "../cmd/secure-service-test.toml")
  26. }
  27. flag.Parse()
  28. if err := conf.Init(); err != nil {
  29. panic(err)
  30. }
  31. d = New(conf.Conf)
  32. os.Exit(m.Run())
  33. }