go-common/app/interface/main/app-view/dao/region/dao_test.go
2019-04-22 18:49:16 +08:00

50 lines
913 B
Go

package region
import (
"context"
"flag"
"os"
"testing"
"time"
"go-common/app/interface/main/app-view/conf"
. "github.com/smartystreets/goconvey/convey"
)
var (
d *Dao
)
func init() {
if os.Getenv("DEPLOY_ENV") != "" {
flag.Set("app_id", "main.app-svr.app-view")
flag.Set("conf_token", "3a4CNLBhdFbRQPs7B4QftGvXHtJo92xw")
flag.Set("tree_id", "4575")
flag.Set("conf_version", "docker-1")
flag.Set("deploy_env", "uat")
flag.Set("conf_host", "config.bilibili.co")
flag.Set("conf_path", "/tmp")
flag.Set("region", "sh")
flag.Set("zone", "sh001")
}
flag.Parse()
if err := conf.Init(); err != nil {
panic(err)
}
d = New(conf.Conf)
time.Sleep(time.Second)
}
func ctx() context.Context {
return context.Background()
}
func TestSeconds(t *testing.T) {
Convey("get Seconds all", t, func() {
res, err := d.Seconds(ctx())
So(err, ShouldBeNil)
So(res, ShouldNotBeEmpty)
})
}