def test_check_override(self):
        roles = self.data.get("roles_meta")
        attributes = self.data.get("attributes")

        limits = LimitsMixin()
        # Set nodes count to 4
        limits.count = 4
        limits.limit_reached = True
        limits.models = {"settings": attributes}
        limits.nodes = self.env.nodes
        # Set "cinder" role to working on
        limits.role = "cinder"
        limits.limit_types = ["max"]
        limits.checked_limit_types = {}
        limits.limit_values = {"max": None}
        override_data = roles["cinder"]["limits"]["overrides"][0]

        result = limits._check_override(override_data)
        self.assertEqual(result[0]["message"], "At most one role_1 node can be added")
Esempio n. 2
0
    def test_check_override(self):
        roles = self.data.get('roles_meta')
        attributes = self.data.get('attributes')

        limits = LimitsMixin()
        # Set nodes count to 4
        limits.count = 4
        limits.limit_reached = True
        limits.models = {'settings': attributes}
        limits.nodes = self.env.nodes
        # Set "cinder" role to working on
        limits.role = 'cinder'
        limits.limit_types = ['max']
        limits.checked_limit_types = {}
        limits.limit_values = {'max': None}
        override_data = roles['cinder']['limits']['overrides'][0]

        result = limits._check_override(override_data)
        self.assertEqual(
            result[0]['message'], 'At most one role_1 node can be added')
Esempio n. 3
0
    def test_check_override(self):
        roles = self.data.get('roles_meta')
        attributes = self.data.get('attributes')

        limits = LimitsMixin()
        # Set nodes count to 4
        limits.count = 4
        limits.limit_reached = True
        limits.models = {'settings': attributes}
        limits.nodes = self.env.nodes
        # Set "cinder" role to working on
        limits.role = 'cinder'
        limits.limit_types = ['max']
        limits.checked_limit_types = {}
        limits.limit_values = {'max': None}
        override_data = roles['cinder']['limits']['overrides'][0]

        result = limits._check_override(override_data)
        self.assertEqual(
            result[0]['message'], 'At most one role_1 node can be added')