本文整理匯總了Golang中github.com/tsuru/tsuru/router.BuildHealthCheck函數的典型用法代碼示例。如果您正苦於以下問題:Golang BuildHealthCheck函數的具體用法?Golang BuildHealthCheck怎麽用?Golang BuildHealthCheck使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BuildHealthCheck函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestBuildHealthCheckUnconfigured
func (s *ExternalSuite) TestBuildHealthCheckUnconfigured(c *check.C) {
if old, err := config.Get("routers"); err == nil {
defer config.Set("routers", old)
}
config.Unset("routers")
fn := router.BuildHealthCheck("fake-hc")
c.Assert(fn(), check.Equals, hc.ErrDisabledComponent)
}
示例2: TestBuildHealthCheckFailure
func (s *ExternalSuite) TestBuildHealthCheckFailure(c *check.C) {
config.Set("routers:fake-hc:type", "fake-hc")
err := errors.New("fatal error")
routertest.HCRouter.SetErr(err)
defer routertest.HCRouter.SetErr(nil)
fn := router.BuildHealthCheck("fake-hc")
c.Assert(fn(), check.Equals, err)
}
示例3: init
func init() {
router.Register(routerName, createRouter)
hc.AddChecker("Router galebv2", router.BuildHealthCheck(routerName))
}
示例4: init
func init() {
router.Register(routerType, createRouter)
router.Register("planb", createRouter)
hc.AddChecker("Router Hipache", router.BuildHealthCheck("hipache"))
hc.AddChecker("Router Planb", router.BuildHealthCheck("planb"))
}
示例5: TestBuildHealthCheckNoHealthChecker
func (s *ExternalSuite) TestBuildHealthCheckNoHealthChecker(c *check.C) {
config.Set("routers:fakeee:type", "fake")
fn := router.BuildHealthCheck("fakeee")
c.Assert(fn(), check.Equals, hc.ErrDisabledComponent)
}
示例6: TestBuildHealthCheckCustomRouter
func (s *ExternalSuite) TestBuildHealthCheckCustomRouter(c *check.C) {
config.Set("routers:fakeee:type", "fake-hc")
fn := router.BuildHealthCheck("fakeee")
c.Assert(fn(), check.IsNil)
}
示例7: init
func init() {
router.Register(routerName, createRouter)
hc.AddChecker("Router Hipache", router.BuildHealthCheck("hipache"))
}
示例8: TestBuildHealthCheckOtherConfigured
func (s *ExternalSuite) TestBuildHealthCheckOtherConfigured(c *check.C) {
config.Set("routers:fake-hc:type", "fake-hc")
fn := router.BuildHealthCheck("other-hc")
c.Assert(fn(), check.Equals, hc.ErrDisabledComponent)
}