Adds else and TODO in statistics storage tests

Fixes bug #1217688

Addresses minor issues that were raised in the code review comments
for Patch Set 10 of "Add SQLAlchemy implementation of groupby"
https://review.openstack.org/#/c/41597/

The issues were in the StatisticsGroupByTest class of the storage
driver tests.

1) Adds else clause to test_group_by_with_query_filter_multiple

   The else clause ensures that all possible values for 'project_id'
   and 'resource_id' are covered when checking the values returned
   by get_meter_statistics().

2) Adds TODO comments for tests that are not implemented

   The tests that have not been implemented are ones involving
   metadata fields, since group by with metadata fields has not yet
   been implemented.

Change-Id: I55cc0cb6cc791708c9b8038787d712760f9515df
This commit is contained in:
Terri Yu 2013-08-28 05:38:48 +00:00
parent b65e93b474
commit 2e484972e1

View File

@ -1067,6 +1067,8 @@ class StatisticsGroupByTest(DBTestBase,
result)
def test_group_by_metadata(self):
# TODO(terriyu): test_group_by_metadata needs to be implemented.
# This test should check grouping by a single metadata field.
pass
def test_group_by_multiple_regular(self):
@ -1132,9 +1134,16 @@ class StatisticsGroupByTest(DBTestBase,
'resource_id': 'resource-2'})
def test_group_by_multiple_metadata(self):
# TODO(terriyu): test_group_by_multiple_metadata needs to be
# implemented.
# This test should check grouping by multiple metadata fields.
pass
def test_group_by_multiple_regular_metadata(self):
# TODO(terriyu): test_group_by_multiple_regular_metadata needs to be
# implemented.
# This test should check grouping by a combination of regular and
# metadata fields.
pass
def test_group_by_with_query_filter(self):
@ -1180,6 +1189,10 @@ class StatisticsGroupByTest(DBTestBase,
self.assertEqual(r.avg, 4)
def test_group_by_metadata_with_query_filter(self):
# TODO(terriyu): test_group_by_metadata_with_query_filter needs to be
# implemented.
# This test should check grouping by a metadata field in combination
# with a query filter.
pass
def test_group_by_with_query_filter_multiple(self):
@ -1226,8 +1239,15 @@ class StatisticsGroupByTest(DBTestBase,
self.assertEqual(r.max, 4)
self.assertEqual(r.sum, 4)
self.assertEqual(r.avg, 4)
else:
self.assertNotEqual(r.groupby, {'project_id': 'project-2',
'resource_id': 'resource-1'})
def test_group_by_metadata_with_query_filter_multiple(self):
# TODO(terriyu): test_group_by_metadata_with_query_filter_multiple
# needs to be implemented.
# This test should check grouping by multiple metadata fields in
# combination with a query filter.
pass
def test_group_by_with_period(self):
@ -1325,6 +1345,10 @@ class StatisticsGroupByTest(DBTestBase,
datetime.datetime(2013, 8, 1, 10, 11)])
def test_group_by_metadata_with_period(self):
# TODO(terriyu): test_group_by_metadata_with_period needs to be
# implemented.
# This test should check grouping by metadata fields in combination
# with period grouping.
pass
def test_group_by_with_query_filter_and_period(self):
@ -1407,6 +1431,10 @@ class StatisticsGroupByTest(DBTestBase,
datetime.datetime(2013, 8, 1, 10, 11)])
def test_group_by_metadata_with_query_filter_and_period(self):
# TODO(terriyu): test_group_by_metadata_with_query_filter_and_period
# needs to be implemented.
# This test should check grouping with metadata fields in combination
# with a query filter and period grouping.
pass