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) }
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) }
func init() { router.Register(routerName, createRouter) hc.AddChecker("Router galebv2", router.BuildHealthCheck(routerName)) }
func init() { router.Register(routerType, createRouter) router.Register("planb", createRouter) hc.AddChecker("Router Hipache", router.BuildHealthCheck("hipache")) hc.AddChecker("Router Planb", router.BuildHealthCheck("planb")) }
func (s *ExternalSuite) TestBuildHealthCheckNoHealthChecker(c *check.C) { config.Set("routers:fakeee:type", "fake") fn := router.BuildHealthCheck("fakeee") c.Assert(fn(), check.Equals, hc.ErrDisabledComponent) }
func (s *ExternalSuite) TestBuildHealthCheckCustomRouter(c *check.C) { config.Set("routers:fakeee:type", "fake-hc") fn := router.BuildHealthCheck("fakeee") c.Assert(fn(), check.IsNil) }
func init() { router.Register(routerName, createRouter) hc.AddChecker("Router Hipache", router.BuildHealthCheck("hipache")) }
func init() { router.Register(routerName, createRouter) hc.AddChecker("Router vulcand", router.BuildHealthCheck("vulcand")) }
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) }