dao_test.go 716 B

1234567891011121314151617181920212223242526272829303132333435
  1. package agent
  2. import (
  3. "flag"
  4. "go-common/app/service/main/videoup/conf"
  5. "gopkg.in/h2non/gock.v1"
  6. "os"
  7. "testing"
  8. )
  9. var (
  10. d *Dao
  11. )
  12. func TestMain(m *testing.M) {
  13. if os.Getenv("DEPLOY_ENV") != "" {
  14. flag.Set("app_id", "main.archive.videoup-service")
  15. flag.Set("conf_token", "4b62721602981eb3635dba3b0d866ac5")
  16. flag.Set("tree_id", "2308")
  17. flag.Set("conf_version", "docker-1")
  18. flag.Set("deploy_env", "uat")
  19. flag.Set("conf_host", "config.bilibili.co")
  20. flag.Set("conf_path", "/tmp")
  21. flag.Set("region", "sh")
  22. flag.Set("zone", "sh001")
  23. }
  24. flag.Parse()
  25. if err := conf.Init(); err != nil {
  26. panic(err)
  27. }
  28. d = New(conf.Conf)
  29. d.proxyClient.SetTransport(gock.DefaultTransport)
  30. m.Run()
  31. os.Exit(0)
  32. }