Beispiel #1
0
 def test_get_cluster_capacity_monthly_resolution(self):
     """Test that cluster capacity returns a full month's capacity."""
     url = '?filter[time_scope_units]=month&filter[time_scope_value]=-1&filter[resolution]=monthly'
     query_params = self.mocked_query_params(url, OCPCpuView)
     handler = OCPReportQueryHandler(query_params)
     query_data = [{'row': 1}]
     query_data, total_capacity = handler.get_cluster_capacity(query_data)
     self.assertTrue('capacity' in total_capacity)
     self.assertTrue(isinstance(total_capacity['capacity'], Decimal))
     self.assertTrue('capacity' in query_data[0])
     self.assertEqual(query_data[0].get('capacity'), total_capacity.get('capacity'))
Beispiel #2
0
 def test_get_cluster_capacity_monthly_resolution(self):
     """Test that cluster capacity returns a full month's capacity."""
     # '?filter[time_scope_units]=month&filter[time_scope_value]=-1&filter[resolution]=monthly'
     params = {
         'filter': {
             'resolution': 'monthly',
             'time_scope_value': -1,
             'time_scope_units': 'month'
         }
     }
     query_params = FakeQueryParameters(params,
                                        report_type='cpu',
                                        tenant=self.tenant)
     handler = OCPReportQueryHandler(query_params.mock_qp)
     query_data = [{'row': 1}]
     query_data, total_capacity = handler.get_cluster_capacity(query_data)
     self.assertTrue('capacity' in total_capacity)
     self.assertTrue(isinstance(total_capacity['capacity'], Decimal))
     self.assertTrue('capacity' in query_data[0])
     self.assertEqual(query_data[0].get('capacity'),
                      total_capacity.get('capacity'))
Beispiel #3
0
    def test_get_cluster_capacity_monthly_resolution(self):
        """Test that cluster capacity returns a full month's capacity."""
        query_params = {
            'filter': {
                'resolution': 'monthly',
                'time_scope_value': -1,
                'time_scope_units': 'month'
            },
        }
        query_string = '?filter[resolution]=monthly&' + \
                       'filter[time_scope_value]=-1&' + \
                       'filter[time_scope_units]=month&'

        handler = OCPReportQueryHandler(query_params, query_string,
                                        self.tenant, **{'report_type': 'cpu'})
        query_data = [{'row': 1}]
        query_data, total_capacity = handler.get_cluster_capacity(query_data)
        self.assertTrue('capacity' in total_capacity)
        self.assertTrue(isinstance(total_capacity['capacity'], Decimal))
        self.assertTrue('capacity' in query_data[0])
        self.assertEqual(query_data[0].get('capacity'),
                         total_capacity.get('capacity'))