broadcast_test.go 910 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package broadcast
  2. import (
  3. "context"
  4. "flag"
  5. "os"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-resource/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. d *Dao
  13. )
  14. func ctx() context.Context {
  15. return context.Background()
  16. }
  17. func init() {
  18. if os.Getenv("DEPLOY_ENV") != "" {
  19. flag.Set("app_id", "main.app-svr.app-resource")
  20. flag.Set("conf_token", "z8JNX5MFIyDxyBsqwQyF6pnjWQ5YOA14")
  21. flag.Set("tree_id", "2722")
  22. flag.Set("conf_version", "docker-1")
  23. flag.Set("deploy_env", "uat")
  24. flag.Set("conf_host", "config.bilibili.co")
  25. flag.Set("conf_path", "/tmp")
  26. flag.Set("region", "sh")
  27. flag.Set("zone", "sh001")
  28. }
  29. flag.Parse()
  30. if err := conf.Init(); err != nil {
  31. panic(err)
  32. }
  33. d = New(conf.Conf)
  34. time.Sleep(time.Second)
  35. }
  36. func TestServerList(t *testing.T) {
  37. Convey("get ServerList all", t, func() {
  38. _, err := d.ServerList(ctx(), "ios")
  39. So(err, ShouldBeNil)
  40. })
  41. }