

def test_clusters_info(self):
    self.env.upload_fixtures(['openstack'])
    info = InstallationInfo()
    release = ReleaseCollection.filter_by(None, operating_system=consts.RELEASE_OS.ubuntu)
    nodes_params = [{
        'roles': ['compute'],
    }, {
        'roles': ['compute'],
    }, {
        'roles': ['controller'],
    }]
    cluster = self.env.create(cluster_kwargs={
        'release_id': release[0].id,
        'mode': consts.CLUSTER_MODES.ha_compact,
        'net_provider': consts.CLUSTER_NET_PROVIDERS.neutron,
    }, nodes_kwargs=nodes_params)
    self.env.create_node({
        'status': consts.NODE_STATUSES.discover,
    })
    clusters_info = info.get_clusters_info()
    self.assertEquals(1, len(clusters_info))
    cluster_info = clusters_info[0]
    self.assertEquals(len(nodes_params), len(cluster_info['nodes']))
    self.assertEquals(len(nodes_params), cluster_info['nodes_num'])
    self.assertEquals(consts.CLUSTER_MODES.ha_compact, cluster_info['mode'])
    self.assertEquals(consts.CLUSTER_NET_PROVIDERS.neutron, cluster_info['net_provider'])
    self.assertEquals(consts.CLUSTER_STATUSES.new, cluster_info['status'])
    self.assertEquals(False, group['is_customized'])
    self.assertEquals(cluster['id'], cluster_info['id'])
    self.assertEquals(cluster.fuel_version, cluster_info['fuel_version'])
    self.assertTrue(('attributes' in cluster_info))
    self.assertTrue(('release' in cluster_info))
    self.assertEquals(cluster.release.operating_system, cluster_info['release']['os'])
    self.assertEquals(cluster.release.name, cluster_info['release']['name'])
    self.assertEquals(cluster.release.version, cluster_info['release']['version'])
    self.assertEquals(1, len(cluster_info['node_groups']))
    group_info = cluster_info['node_groups'][0]
    group = [ng for ng in cluster.node_groups][0]
    self.assertEquals(group.id, group_info['id'])
    self.assertEquals(len(nodes_params), len(group_info['nodes']))
    self.assertEquals(set([n.id for n in group.nodes]), set(group_info['nodes']))

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/unit/fuel_statistics_tests/test_installation_info.py TestInstallationInfo.test_clusters_info/VarMisuse@262/384 `cluster_info`->`group`