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")))
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")))
def test_active_suspended(self): """ Convergence is not triggerred on ACTIVE suspended group """ self.state.suspended = True seq = [ (GetScalingGroupInfo(tenant_id="tid", group_id="gid"), const(("group", self.manifest))), ] self.assertIsNone( perform_sequence(seq, sh.check_and_trigger("tid", "gid")))
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")))
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")))
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")))