예제 #1
0
func (s *ELBSuite) TestELBInstanceHealer(c *gocheck.C) {
	lb := "elbtest"
	instance := s.server.NewInstance()
	defer s.server.RemoveInstance(instance)
	s.server.NewLoadBalancer(lb)
	defer s.server.RemoveLoadBalancer(lb)
	s.server.RegisterInstance(instance, lb)
	defer s.server.DeregisterInstance(instance, lb)
	a := app.App{
		Name:  "elbtest",
		Units: []app.Unit{{InstanceId: instance, State: "error", Name: "elbtest/0"}},
	}
	storage, err := db.Conn()
	c.Assert(err, gocheck.IsNil)
	err = storage.Apps().Insert(a)
	c.Assert(err, gocheck.IsNil)
	defer storage.Apps().Remove(bson.M{"name": a.Name})
	s.provisioner.Provision(&a)
	defer s.provisioner.Destroy(&a)
	state := elb.InstanceState{
		Description: "Instance has failed at least the UnhealthyThreshold number of health checks consecutively.",
		State:       "OutOfService",
		ReasonCode:  "Instance",
		InstanceId:  instance,
	}
	s.server.ChangeInstanceState(lb, state)
	healer := elbInstanceHealer{}
	err = healer.Heal()
	c.Assert(err, gocheck.IsNil)
	err = a.Get()
	c.Assert(err, gocheck.IsNil)
	c.Assert(a.Units, gocheck.HasLen, 1)
	c.Assert(a.Units[0].InstanceId, gocheck.Not(gocheck.Equals), instance)
	queue.Preempt()
}
예제 #2
0
파일: suite_test.go 프로젝트: nedmax/tsuru
func (s *S) TearDownSuite(c *gocheck.C) {
	defer s.t.S3Server.Quit()
	defer s.t.IamServer.Quit()
	s.conn.Apps().Database.DropDatabase()
	fsystem = nil
	queue.Preempt()
}
예제 #3
0
func (s *ELBSuite) TearDownSuite(c *gocheck.C) {
	config.Unset("juju:use-elb")
	s.conn.Collection("juju_units_test_elb").Database.DropDatabase()
	s.server.Quit()
	queue.Preempt()
}
예제 #4
0
파일: suite_test.go 프로젝트: nedmax/tsuru
func (s *S) TearDownSuite(c *gocheck.C) {
	queue.Preempt()
	s.conn.Collection(s.collName).Database.DropDatabase()
	s.conn.Collection("juju_bootstrap_test").Database.DropDatabase()
}