cache_test.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package cache
  2. import (
  3. "flag"
  4. "os"
  5. "testing"
  6. "go-common/app/interface/main/mcn/conf"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestMain(m *testing.M) {
  10. if os.Getenv("DEPLOY_ENV") != "" {
  11. flag.Set("app_id", "main.archive.mcn-interface")
  12. flag.Set("conf_token", "49e4671bafbf93059aeb602685052ca0")
  13. flag.Set("tree_id", "58909")
  14. flag.Set("conf_version", "docker-1")
  15. flag.Set("deploy_env", "uat")
  16. flag.Set("conf_host", "config.bilibili.co")
  17. flag.Set("conf_path", "/tmp")
  18. flag.Set("region", "sh")
  19. flag.Set("zone", "sh001")
  20. } else {
  21. flag.Set("conf", "../../cmd/mcn-interface.toml")
  22. }
  23. if os.Getenv("UT_LOCAL_TEST") != "" {
  24. flag.Set("conf", "../../cmd/mcn-interface.toml")
  25. }
  26. flag.Parse()
  27. if err := conf.Init(); err != nil {
  28. panic(err)
  29. }
  30. os.Exit(m.Run())
  31. }
  32. func TestCacheLoadCache(t *testing.T) {
  33. convey.Convey("LoadCache", t, func(ctx convey.C) {
  34. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  35. LoadCache()
  36. ctx.Convey("No return values", func(ctx convey.C) {
  37. })
  38. })
  39. })
  40. }