Merge "Fix an invalid test in the storage test suite"

This commit is contained in:
Jenkins 2013-03-06 14:30:39 +00:00 committed by Gerrit Code Review
commit 54432375ac

View File

@ -804,18 +804,18 @@ class StatisticsTest(DBTestBase):
self.assertEqual(set(r['period_end'] for r in results), self.assertEqual(set(r['period_end'] for r in results),
set([datetime.datetime(2012, 9, 25, 12, 28), set([datetime.datetime(2012, 9, 25, 12, 28),
datetime.datetime(2012, 9, 25, 14, 28)])) datetime.datetime(2012, 9, 25, 14, 28)]))
for r in results: r = results[0]
if r['period_start'] == datetime.datetime(2012, 9, 25, 10, 0): self.assertEqual(r['period_start'],
datetime.datetime(2012, 9, 25, 10, 28))
self.assertEqual(r['count'], 2) self.assertEqual(r['count'], 2)
self.assertEqual(r['avg'], 8.5) self.assertEqual(r['avg'], 8.5)
self.assertEqual(r['min'], 8) self.assertEqual(r['min'], 8)
self.assertEqual(r['max'], 9) self.assertEqual(r['max'], 9)
self.assertEqual(r['sum'], 17) self.assertEqual(r['sum'], 17)
self.assertEqual(r['period'], 7200) self.assertEqual(r['period'], 7200)
self.assertEqual(isinstance(r['period'], int)) self.assertIsInstance(r['period'], int)
self.assertEqual(r['period_end'], expected_end = r['period_start'] + datetime.timedelta(seconds=7200)
r['period_start'] self.assertEqual(r['period_end'], expected_end)
+ datetime.timedelta(seconds=7200))
self.assertEqual(r['duration'], 3660) self.assertEqual(r['duration'], 3660)
self.assertEqual(r['duration_start'], self.assertEqual(r['duration_start'],
datetime.datetime(2012, 9, 25, 10, 30)) datetime.datetime(2012, 9, 25, 10, 30))