func (s *discoverySuite) TestDiscoverLocalInitSystemMatchNone(c *gc.C) { s.PatchLocalDiscovery( service.NewDiscoveryCheck("initA", false, nil), service.NewDiscoveryCheck("initB", false, nil), ) _, err := service.DiscoverLocalInitSystem() c.Check(err, jc.Satisfies, errors.IsNotFound) }
func (s *discoverySuite) TestDiscoverLocalInitSystemErrorMixed(c *gc.C) { failure := errors.New("<failed>") s.PatchLocalDiscovery( service.NewDiscoveryCheck("initA", false, failure), service.NewDiscoveryCheck("initB", false, nil), ) _, err := service.DiscoverLocalInitSystem() c.Check(err, jc.Satisfies, errors.IsNotFound) }
func (s *discoverySuite) TestDiscoverLocalInitSystemMatchSecond(c *gc.C) { s.PatchLocalDiscovery( service.NewDiscoveryCheck("initA", false, nil), service.NewDiscoveryCheck("initB", true, nil), ) name, err := service.DiscoverLocalInitSystem() c.Assert(err, jc.ErrorIsNil) c.Check(name, gc.Equals, "initB") }
func (s *discoverySuite) TestDiscoverLocalInitSystemMatchFirstError(c *gc.C) { failure := errors.New("<failed>") s.PatchLocalDiscovery( service.NewDiscoveryCheck("initA", true, failure), service.NewDiscoveryCheck("initB", false, nil), ) name, err := service.DiscoverLocalInitSystem() c.Assert(err, jc.ErrorIsNil) c.Check(name, gc.Equals, "initA") }