dao_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package relation
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "os"
  7. "testing"
  8. "go-common/app/admin/main/credit/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var d *Dao
  12. func TestMain(m *testing.M) {
  13. if os.Getenv("DEPLOY_ENV") != "" {
  14. flag.Set("app_id", "main.account-law.credit-admin")
  15. flag.Set("conf_appid", "main.account-law.credit-admin")
  16. flag.Set("conf_token", "eKmbn2M4jvSyyjMEOywLFOQlX5ggRG9x")
  17. flag.Set("tree_id", "5885")
  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/convey-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. }
  35. func TestDaoRPCStats(t *testing.T) {
  36. Convey("return someting", t, func() {
  37. res, err := d.RPCStats(context.TODO(), []int64{88889018, 2089809})
  38. for _, re := range res {
  39. fmt.Printf("re:%#v \n", re)
  40. }
  41. So(err, ShouldBeNil)
  42. So(res, ShouldNotBeNil)
  43. })
  44. }