UCA repos info added to statistics

UCA repos info added to collected by fuel-stats data.

Tests for checking that all cluster attributes are in filtering
WhiteList refactored to use releases with the same
operating_system value.
Now we are able to check attributes for Ubuntu and
Ubuntu+UCA releases.

Change-Id: I951324b34dc2ed7b6966316cc59ee2fe81872b04
Closes-Bug: #1558172
This commit is contained in:
Alexander Kislitsky 2016-03-17 17:51:31 +03:00
parent e01cd884f6
commit 71d1ec2ab5
2 changed files with 56 additions and 23 deletions

View File

@ -77,8 +77,15 @@ class InstallationInfo(object):
WhiteListRule(('external_ntp', 'ntp_list', 'value'),
'external_ntp_list', bool),
WhiteListRule(('repo_setup', 'repos', 'value'), 'repos', bool),
WhiteListRule(('repo_setup', 'repos', 'value'), 'repos', None),
WhiteListRule(('repo_setup', 'pin_ceph', 'value'),
'pin_ceph', bool),
WhiteListRule(('repo_setup', 'pin_haproxy', 'value'),
'pin_haproxy', bool),
WhiteListRule(('repo_setup', 'pin_rabbitmq', 'value'),
'pin_rabbitmq', bool),
WhiteListRule(('repo_setup', 'repo_type', 'value'),
'repo_type', None),
WhiteListRule(('storage', 'volumes_lvm', 'value'),
'volumes_lvm', None),
WhiteListRule(('storage', 'iser', 'value'), 'iser', None),

View File

@ -50,39 +50,65 @@ class TestInstallationInfo(BaseTestCase):
def test_get_attributes_centos(self):
self.skipTest('CentOS is unavailable in current release.')
self.env.upload_fixtures(['openstack'])
releases = ReleaseCollection.filter_by(
None, operating_system=consts.RELEASE_OS.centos)
release = releases[0]
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system='CentOS')
attr_key_list = [a[1] for a in info.attributes_white_list]
# No UCA configs for CentOS.
expected_attributes = set(attr_key_list) - set(
('pin_haproxy', 'repo_type', 'pin_ceph', 'pin_rabbitmq'))
self._do_test_attributes_in_white_list(
release, expected_attributes)
def _do_test_attributes_in_white_list(self, release,
expected_attributes):
cluster_data = self.env.create_cluster(
release_id=release[0].id
release_id=release.id
)
cluster = Cluster.get_by_uid(cluster_data['id'])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
info = InstallationInfo()
actual_attributes = info.get_attributes(
editable, info.attributes_white_list)
self.assertEqual(
set(attr_key_list),
set(attrs_dict.keys())
set(expected_attributes),
set(actual_attributes.keys())
)
def test_get_attributes_ubuntu(self):
self.env.upload_fixtures(['openstack'])
releases = ReleaseCollection.filter_by(
None, operating_system=consts.RELEASE_OS.ubuntu).order_by(
ReleaseCollection.single.model.id).all()
release = releases[0]
info = InstallationInfo()
release = ReleaseCollection.filter_by(None, operating_system='Ubuntu')
cluster_data = self.env.create_cluster(
release_id=release[0].id
)
cluster = Cluster.get_by_uid(cluster_data['id'])
editable = cluster.attributes.editable
attr_key_list = [a[1] for a in info.attributes_white_list]
attrs_dict = info.get_attributes(editable, info.attributes_white_list)
self.assertEqual(
# No vlan splinters for ubuntu.
# And no mellanox related entries since 8.0.
set(attr_key_list) - set(
('vlan_splinters', 'vlan_splinters_ovs',
'mellanox', 'mellanox_vf_num', 'iser')),
set(attrs_dict.keys())
)
# No vlan splinters for Ubuntu, no mellanox related entries
# since 8.0, no UCA repos settings.
expected_attributes = set(attr_key_list) - set(
('vlan_splinters', 'vlan_splinters_ovs',
'mellanox', 'mellanox_vf_num', 'iser', 'pin_haproxy',
'repo_type', 'pin_ceph', 'pin_rabbitmq'))
self._do_test_attributes_in_white_list(
release, expected_attributes)
def test_get_attributes_ubuntu_uca(self):
self.env.upload_fixtures(['openstack'])
releases = ReleaseCollection.filter_by(
None, operating_system=consts.RELEASE_OS.ubuntu).order_by(
ReleaseCollection.single.model.id)
release = releases[1]
info = InstallationInfo()
attr_key_list = [a[1] for a in info.attributes_white_list]
# No vlan splinters for Ubuntu, no mellanox related entries
# since 8.0.
expected_attributes = set(attr_key_list) - set(
('vlan_splinters', 'vlan_splinters_ovs',
'mellanox', 'mellanox_vf_num', 'iser'))
self._do_test_attributes_in_white_list(
release, expected_attributes)
def test_get_empty_attributes(self):
info = InstallationInfo()