A collection of Ansible playbooks to detect and report potential issues during TripleO deployments
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
Tests for the `check_flavors` module.
from unittest import mock
except ImportError:
import mock
from tripleo_validations.tests import base
from tripleo_validations.tests import fakes
from library import check_flavors
class TestCheckFlavors(base.TestCase):
def setUp(self):
self.tested_module = check_flavors
return super().setUp()
def test_module_init(self):
expepect_attrs = set(
actual_attrs = set(dir(self.tested_module))
def test_validate_roles_and_flavors(self):
expected_values = fakes.MOCK_FLAVORS_CHECK_EXPECTED['ok']
return_value = self.tested_module.validate_roles_and_flavors(
self.assertEqual(expected_values, return_value)
def test_validate_roles_and_flavors_nocpu(self):
"""Tests situation when the 'VCPU' key doesn't have associated value.
'DISK_GB' and 'MEMORY_MB' behave the same way,
so we don't need to test them. For now at least.
expected_values = fakes.MOCK_FLAVORS_CHECK_EXPECTED['fail_NOVCPU']
return_value = self.tested_module.validate_roles_and_flavors(
self.assertEqual(expected_values, return_value)