def test_installation_info(self):
     info = InstallationInfo()
     nodes_params = [
         {'roles': ['compute']},
         {'roles': ['compute']},
         {'roles': ['controller']}
     ]
     self.env.create(
         release_kwargs={
             'operating_system': consts.RELEASE_OS.centos
         },
         cluster_kwargs={},
         nodes_kwargs=nodes_params
     )
     unallocated_nodes_params = [
         {'status': consts.NODE_STATUSES.discover},
         {'status': consts.NODE_STATUSES.discover}
     ]
     for unallocated_node in unallocated_nodes_params:
         self.env.create_node(**unallocated_node)
     info = info.get_installation_info()
     self.assertEquals(1, info['clusters_num'])
     self.assertEquals(len(nodes_params), info['allocated_nodes_num'])
     self.assertEquals(len(unallocated_nodes_params),
                       info['unallocated_nodes_num'])
     self.assertTrue('master_node_uid' in info)
     self.assertTrue('contact_info_provided' in info['user_information'])
     self.assertDictEqual(settings.VERSION, info['fuel_release'])
Example #2
0
    def test_all_cluster_data_collected(self):
        self.env.create(nodes_kwargs=[{'roles': ['compute']}])
        self.env.create_node(status=consts.NODE_STATUSES.discover)

        # Fetching installation info struct
        info = InstallationInfo()
        info = info.get_installation_info()
        actual_cluster = info['clusters'][0]

        cluster_schema = self.get_model_schema(models.Cluster)

        # Removing of not required fields
        remove_fields = ('tasks', 'cluster_changes', 'nodegroups', 'releases',
                         'replaced_provisioning_info', 'notifications',
                         'cluster_deployment_graphs', 'name',
                         'replaced_deployment_info', 'ui_settings')
        for field in remove_fields:
            cluster_schema.pop(field)
        # Renaming fields for matching
        rename_fields = (
            ('plugins', 'installed_plugins'),
            ('networking_configs', 'network_configuration'),
            ('release_id', 'release'),
            ('cluster_plugin_links', 'plugin_links'),
        )
        for name_from, name_to in rename_fields:
            cluster_schema.pop(name_from)
            cluster_schema[name_to] = None

        # If test failed here it means, that you have added properties
        # to cluster and they are not exported into statistics.
        # If you don't know  what to do, contact fuel-stats team please.
        for key in six.iterkeys(cluster_schema):
            self.assertIn(key, actual_cluster)
Example #3
0
 def test_installation_info(self):
     info = InstallationInfo()
     nodes_params = [{
         'roles': ['compute']
     }, {
         'roles': ['compute']
     }, {
         'roles': ['controller']
     }]
     self.env.create(
         release_kwargs={'operating_system': consts.RELEASE_OS.centos},
         cluster_kwargs={},
         nodes_kwargs=nodes_params)
     unallocated_nodes_params = [{
         'status': consts.NODE_STATUSES.discover
     }, {
         'status': consts.NODE_STATUSES.discover
     }]
     for unallocated_node in unallocated_nodes_params:
         self.env.create_node(**unallocated_node)
     info = info.get_installation_info()
     self.assertEquals(1, info['clusters_num'])
     self.assertEquals(len(nodes_params), info['allocated_nodes_num'])
     self.assertEquals(len(unallocated_nodes_params),
                       info['unallocated_nodes_num'])
     self.assertTrue('master_node_uid' in info)
     self.assertTrue('contact_info_provided' in info['user_information'])
     self.assertDictEqual(settings.VERSION, info['fuel_release'])
    def test_all_cluster_data_collected(self):
        self.env.create(nodes_kwargs=[{"roles": ["compute"]}])
        self.env.create_node(status=consts.NODE_STATUSES.discover)

        # Fetching installation info struct
        info = InstallationInfo()
        info = info.get_installation_info()
        actual_cluster = info["clusters"][0]

        # Creating cluster schema
        cluster_schema = {}
        for column in inspect(cluster_model.Cluster).columns:
            cluster_schema[six.text_type(column.name)] = None
        for rel in inspect(cluster_model.Cluster).relationships:
            cluster_schema[six.text_type(rel.table.name)] = None

        # Removing of not required fields
        remove_fields = (
            "tasks",
            "cluster_changes",
            "nodegroups",
            "pending_release_id",
            "releases",
            "replaced_provisioning_info",
            "notifications",
            "deployment_tasks",
            "name",
            "replaced_deployment_info",
            "ui_settings",
        )
        for field in remove_fields:
            cluster_schema.pop(field)
        # Renaming fields for matching
        rename_fields = (
            ("plugins", "installed_plugins"),
            ("networking_configs", "network_configuration"),
            ("release_id", "release"),
        )
        for name_from, name_to in rename_fields:
            cluster_schema.pop(name_from)
            cluster_schema[name_to] = None

        # If test failed here it means, that you have added properties
        # to cluster and they are not exported into statistics.
        # If you don't know  what to do, contact fuel-stats team please.
        for key in six.iterkeys(cluster_schema):
            self.assertIn(key, actual_cluster)
 def test_installation_info(self):
     info = InstallationInfo()
     nodes_params = [{"roles": ["compute"]}, {"roles": ["compute"]}, {"roles": ["controller"]}]
     self.env.create(
         release_kwargs={"operating_system": consts.RELEASE_OS.centos}, cluster_kwargs={}, nodes_kwargs=nodes_params
     )
     unallocated_nodes_params = [
         {"status": consts.NODE_STATUSES.discover},
         {"status": consts.NODE_STATUSES.discover},
     ]
     for unallocated_node in unallocated_nodes_params:
         self.env.create_node(**unallocated_node)
     info = info.get_installation_info()
     self.assertEquals(1, info["clusters_num"])
     self.assertEquals(len(nodes_params), info["allocated_nodes_num"])
     self.assertEquals(len(unallocated_nodes_params), info["unallocated_nodes_num"])
     self.assertTrue("master_node_uid" in info)
     self.assertTrue("contact_info_provided" in info["user_information"])
     self.assertDictEqual(settings.VERSION, info["fuel_release"])
    def test_all_cluster_data_collected(self):
        self.env.create(nodes_kwargs=[{'roles': ['compute']}])
        self.env.create_node(status=consts.NODE_STATUSES.discover)

        # Fetching installation info struct
        info = InstallationInfo()
        info = info.get_installation_info()
        actual_cluster = info['clusters'][0]

        cluster_schema = self.get_model_schema(models.Cluster)

        # Removing of not required fields
        remove_fields = (
            'tasks', 'cluster_changes', 'nodegroups',
            'releases', 'replaced_provisioning_info', 'notifications',
            'cluster_deployment_graphs', 'name', 'replaced_deployment_info',
            'ui_settings'
        )
        for field in remove_fields:
            cluster_schema.pop(field)
        # Renaming fields for matching
        rename_fields = (
            ('plugins', 'installed_plugins'),
            ('networking_configs', 'network_configuration'),
            ('release_id', 'release'),
            ('cluster_plugin_links', 'plugin_links'),
        )
        for name_from, name_to in rename_fields:
            cluster_schema.pop(name_from)
            cluster_schema[name_to] = None

        # If test failed here it means, that you have added properties
        # to cluster and they are not exported into statistics.
        # If you don't know  what to do, contact fuel-stats team please.
        for key in six.iterkeys(cluster_schema):
            self.assertIn(key, actual_cluster)