本文整理汇总了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)
}