8a0f06ac79
Added instance hours report Initial version of report to calculate unit hours used for nova instances Breakdown by flavor, flavor class, account/billing types and by tenant. Moved license so script has shebang as the first line Add tenant info cache. Refactor Instance hr report. Added cache table for basic tenant info for reports. Refactor instance_hours report to use table. Improve performance of tenant info update. use bulk sql operations to speed up the tenant info update, as it's taking ~40s/1000 tenants to update on a decent machine. Fix some tests broken by rebase. Fix unittests broken by rebase. Also, renumber migration due to collision. Add Apache license header to new files. Fixed bug with fetching deployment information in reconciler. Reverted old method for fetching current usage's deployment and added new method to fetch latest deployment information for a request_id. Made the field mismatch error message more readable Refactored nova and glance verifier tests the exists are updated with 201 send_status as part of stacktach down repair mechanism Revert "Fixed bug with fetching deployment information in" Revert "Adding host and deployment info to missing exists entries in the nova usage audit" Revert "Added column headers for host and deployment in json reports" Only log ERROR on last retry fixed the wrong status name for sent_failed variable in audit report fixing documentation for urls that are not available for glance deprecating stacky urls (usage, deletes, exists) that are not used anymore Revert "Revert "Added column headers for host and deployment in json reports"" Revert "Revert "Adding host and deployment info to missing exists entries in the nova usage audit"" Revert "Revert "Fixed bug with fetching deployment information in"" Cell and compute info added for verification failures as well. If that is not present(request_id is not populated for an InstanceUsage entry), the cells display '-' Add tox support for move to stackforge Add tox support for move to stackforge Change-Id: Id94c2a7f1f9061e972e90c3f54e39c9dec11943b
66 lines
2.3 KiB
Python
66 lines
2.3 KiB
Python
import mox
|
|
from tests.unit import StacktachBaseTestCase, utils
|
|
from verifier import NotFound, AmbiguousResults, FieldMismatch
|
|
from verifier import NullFieldException, WrongTypeException
|
|
|
|
|
|
class VerificationExceptionTestCase(StacktachBaseTestCase):
|
|
def setUp(self):
|
|
self.mox = mox.Mox()
|
|
|
|
def tearDown(self):
|
|
self.mox.UnsetStubs()
|
|
|
|
def test_not_found_exception(self):
|
|
exception = NotFound('object_type', 'search_params')
|
|
|
|
self.assertEqual(exception.reason,
|
|
"Couldn't find object_type using search_params")
|
|
|
|
def test_ambiguous_results_exception(self):
|
|
exception = AmbiguousResults('object_type', 'search_params')
|
|
|
|
self.assertEqual(
|
|
exception.reason,
|
|
"Ambiguous results for object_type using search_params")
|
|
|
|
def test_field_mismatch_exception(self):
|
|
utils.mock_datetime_utcnow(self.mox, '2014-01-02 03:04:05')
|
|
|
|
exception = FieldMismatch(
|
|
'field_name',
|
|
{'name': 'entity1', 'value': 'expected'},
|
|
{'name': 'entity2', 'value': 'actual'},
|
|
'uuid')
|
|
|
|
self.assertEqual(
|
|
exception.reason,
|
|
"Failed at 2014-01-02 03:04:05 UTC for uuid: Data mismatch for "
|
|
"'field_name' - 'entity1' contains 'expected' but 'entity2' "
|
|
"contains 'actual'")
|
|
|
|
def test_null_field_exception(self):
|
|
utils.mock_datetime_utcnow(self.mox, '2014-01-02 03:04:05')
|
|
|
|
exception = NullFieldException('field_name', 'exist_id', 'uuid')
|
|
|
|
self.assertEqual(exception.field_name, 'field_name')
|
|
self.assertEqual(
|
|
exception.reason,
|
|
"Failed at 2014-01-02 03:04:05 UTC for uuid: field_name field was "
|
|
"null for exist id exist_id")
|
|
|
|
def test_wrong_type_exception(self):
|
|
utils.mock_datetime_utcnow(self.mox, '2014-01-02 03:04:05')
|
|
|
|
exception = WrongTypeException(
|
|
'field_name', 'value', 'exist_id', 'uuid')
|
|
self.assertEqual(exception.field_name, 'field_name')
|
|
self.assertEqual(exception.value, 'value')
|
|
self.assertEqual(exception.exist_id, 'exist_id')
|
|
self.assertEqual(exception.uuid, 'uuid')
|
|
self.assertEqual(
|
|
exception.reason,
|
|
"Failed at 2014-01-02 03:04:05 UTC for uuid: {field_name: value} "
|
|
"was of incorrect type for exist id exist_id")
|