Example #1
0
 def test_inactive_group(self):
     """
     Convergence is not triggerred on in-ACTIVE group
     """
     self.state.status = ScalingGroupStatus.ERROR
     seq = [
         (GetScalingGroupInfo(tenant_id="tid", group_id="gid"),
          const(("group", self.manifest))),
     ]
     self.assertIsNone(
         perform_sequence(seq, sh.check_and_trigger("tid", "gid")))
Example #2
0
 def test_active_paused(self):
     """
     Convergence is not triggerred on ACTIVE paused group
     """
     self.state.paused = True
     seq = [
         (GetScalingGroupInfo(tenant_id="tid", group_id="gid"),
          const(("group", self.manifest))),
     ]
     self.assertIsNone(
         perform_sequence(seq, sh.check_and_trigger("tid", "gid")))
Example #3
0
 def test_filtered(self):
     """
     Only convgergence enabled tenants are returned
     """
     conf = {"non-convergence-tenants": ["t1"]}
     groups = [{"tenantId": "t1", "groupId": "g1"},
               {"tenantId": "t1", "groupId": "g12"},
               {"tenantId": "t2", "groupId": "g2"},
               {"tenantId": "t3", "groupId": "g3"}]
     eff = sh.get_groups_to_converge(conf.get)
     seq = [(GetAllValidGroups(), const(groups))]
     self.assertEqual(perform_sequence(seq, eff), groups[2:])
Example #4
0
 def test_group_deleted(self):
     """
     Does nothing if group has been deleted
     """
     seq = [
         (GetScalingGroupInfo(tenant_id="tid", group_id="gid"),
          lambda i: raise_(NoSuchScalingGroupError("tid", "gid"))),
         (Log("selfheal-group-deleted",
              dict(tenant_id="tid", scaling_group_id="gid")),
          noop)
     ]
     self.assertIsNone(
         perform_sequence(seq, sh.check_and_trigger("tid", "gid")))
Example #5
0
 def test_active_resumed(self):
     """
     Convergence is triggerred on ACTIVE resumed group
     """
     seq = [
         (GetScalingGroupInfo(tenant_id="tid", group_id="gid"),
          const(("group", self.manifest))),
         (BoundFields(effect=mock.ANY,
                      fields=dict(tenant_id="tid", scaling_group_id="gid")),
          nested_sequence([(("tg", "tid", "gid"), noop)]))
     ]
     self.assertIsNone(
         perform_sequence(seq, sh.check_and_trigger("tid", "gid")))