Beispiel #1
0
func (s *MigrationImportSuite) TestServiceLeaders(c *gc.C) {
	s.makeServiceWithLeader(c, "mysql", 2, 1)
	s.makeServiceWithLeader(c, "wordpress", 4, 2)

	_, newSt := s.importModel(c)
	defer newSt.Close()

	leaders := make(map[string]string)
	for key, value := range state.LeadershipLeases(newSt) {
		leaders[key] = value.Holder
	}
	c.Assert(leaders, jc.DeepEquals, map[string]string{
		"mysql":     "mysql/1",
		"wordpress": "wordpress/2",
	})
}
Beispiel #2
0
func (s *MigrationImportSuite) TestApplicationLeaders(c *gc.C) {
	s.makeApplicationWithLeader(c, "mysql", 2, 1)
	s.makeApplicationWithLeader(c, "wordpress", 4, 2)

	_, newSt := s.importModel(c)

	leaders := make(map[string]string)
	leases, err := state.LeadershipLeases(newSt)
	c.Assert(err, jc.ErrorIsNil)
	for key, value := range leases {
		leaders[key] = value.Holder
	}
	c.Assert(leaders, jc.DeepEquals, map[string]string{
		"mysql":     "mysql/1",
		"wordpress": "wordpress/2",
	})
}