Add hacking checks to watcher

The hacking checks enforce during the pep8 run functional validations of
the code to ensure deeper filters and code consistency.  This change set
adds the hacking checks to the wathcer project.  These checks were
seeded from the neutron project, which had a good set of base defaults.

This change set also updates the watcher project to be compliant with
these new hacking checks.

Change-Id: I6f4566d384a7400bddf228aa127a53e6ecc82c2e
This commit is contained in:
Drew Thorstensen
2016-07-20 16:05:01 -07:00
parent 65d3a4d75e
commit 7d704dbeec
31 changed files with 398 additions and 75 deletions

View File

@@ -125,15 +125,15 @@ class TestVMWorkloadConsolidation(base.BaseTestCase):
h1 = model.get_hypervisor_from_id('Node_0')
cc = {'cpu': 1.0, 'ram': 1.0, 'disk': 1.0}
res = self.strategy.is_overloaded(h1, model, cc)
self.assertEqual(False, res)
self.assertFalse(res)
cc = {'cpu': 0.025, 'ram': 1.0, 'disk': 1.0}
res = self.strategy.is_overloaded(h1, model, cc)
self.assertEqual(False, res)
self.assertFalse(res)
cc = {'cpu': 0.024, 'ram': 1.0, 'disk': 1.0}
res = self.strategy.is_overloaded(h1, model, cc)
self.assertEqual(True, res)
self.assertTrue(res)
def test_vm_fits(self):
model = self.fake_cluster.generate_scenario_1()
@@ -143,11 +143,11 @@ class TestVMWorkloadConsolidation(base.BaseTestCase):
vm_uuid = 'VM_0'
cc = {'cpu': 1.0, 'ram': 1.0, 'disk': 1.0}
res = self.strategy.vm_fits(vm_uuid, h, model, cc)
self.assertEqual(True, res)
self.assertTrue(res)
cc = {'cpu': 0.025, 'ram': 1.0, 'disk': 1.0}
res = self.strategy.vm_fits(vm_uuid, h, model, cc)
self.assertEqual(False, res)
self.assertFalse(res)
def test_add_action_enable_hypervisor(self):
model = self.fake_cluster.generate_scenario_1()

View File

@@ -139,7 +139,7 @@ class TestWorkloadBalance(base.BaseTestCase):
self.strategy.ceilometer = mock.MagicMock(
statistic_aggregation=self.fake_metrics.mock_get_statistics_wb)
solution = self.strategy.execute()
self.assertEqual(solution.actions, [])
self.assertEqual([], solution.actions)
def test_execute(self):
model = self.fake_cluster.generate_scenario_6_with_2_hypervisors()