Added efficacy indicators to /action_plans
I this changeset, I added the efficacy indicators both at the DB and at the API level alongside the associated logic. Partially Implements: blueprint efficacy-indicator Change-Id: I824553637621da67966103c1b0c01348b09bd836
This commit is contained in:
@@ -47,7 +47,13 @@ class FakeStrategy(base_strategy.BaseStrategy):
|
||||
def get_config_opts(cls):
|
||||
return []
|
||||
|
||||
def execute(self, original_model):
|
||||
def pre_execute(self):
|
||||
pass
|
||||
|
||||
def do_execute(self):
|
||||
pass
|
||||
|
||||
def post_execute(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -53,14 +53,17 @@ class SolutionFakerSingleHyp(object):
|
||||
current_state_cluster.generate_scenario_3_with_2_hypervisors())
|
||||
sercon.ceilometer = mock.MagicMock(
|
||||
get_statistics=metrics.mock_get_statistics)
|
||||
|
||||
return sercon.execute()
|
||||
|
||||
|
||||
class TestActionScheduling(base.DbTestCase):
|
||||
|
||||
def test_schedule_actions(self):
|
||||
default_planner = pbase.DefaultPlanner(mock.Mock())
|
||||
audit = db_utils.create_test_audit(uuid=utils.generate_uuid())
|
||||
solution = dsol.DefaultSolution()
|
||||
solution = dsol.DefaultSolution(
|
||||
goal=mock.Mock(), strategy=mock.Mock())
|
||||
|
||||
parameters = {
|
||||
"src_uuid_hypervisor": "server1",
|
||||
@@ -86,7 +89,8 @@ class TestActionScheduling(base.DbTestCase):
|
||||
def test_schedule_two_actions(self):
|
||||
default_planner = pbase.DefaultPlanner(mock.Mock())
|
||||
audit = db_utils.create_test_audit(uuid=utils.generate_uuid())
|
||||
solution = dsol.DefaultSolution()
|
||||
solution = dsol.DefaultSolution(
|
||||
goal=mock.Mock(), strategy=mock.Mock())
|
||||
|
||||
parameters = {
|
||||
"src_uuid_hypervisor": "server1",
|
||||
|
||||
@@ -14,13 +14,16 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
|
||||
from watcher.decision_engine.solution import default
|
||||
from watcher.tests import base
|
||||
|
||||
|
||||
class TestDefaultSolution(base.BaseTestCase):
|
||||
def test_default_solution(self):
|
||||
solution = default.DefaultSolution()
|
||||
solution = default.DefaultSolution(
|
||||
goal=mock.Mock(), strategy=mock.Mock())
|
||||
parameters = {
|
||||
"src_uuid_hypervisor": "server1",
|
||||
"dst_uuid_hypervisor": "server2",
|
||||
|
||||
@@ -60,7 +60,6 @@ class TestStrategySelector(base.TestCase):
|
||||
@mock.patch.object(default_loader.DefaultStrategyLoader, 'list_available')
|
||||
def test_select_no_available_strategy_for_goal(self, m_list_available):
|
||||
m_list_available.return_value = {}
|
||||
strategy_selector = default_selector.DefaultStrategySelector(
|
||||
"dummy")
|
||||
strategy_selector = default_selector.DefaultStrategySelector("dummy")
|
||||
self.assertRaises(exception.NoAvailableStrategyForGoal,
|
||||
strategy_selector.select)
|
||||
|
||||
@@ -180,7 +180,7 @@ class TestBasicConsolidation(base.BaseTestCase):
|
||||
) as mock_score_call:
|
||||
mock_score_call.return_value = 0
|
||||
solution = self.strategy.execute()
|
||||
self.assertEqual(0, solution.efficacy)
|
||||
self.assertEqual(0, solution.efficacy.global_efficacy.value)
|
||||
|
||||
def test_check_parameters(self):
|
||||
model = self.fake_cluster.generate_scenario_3_with_2_hypervisors()
|
||||
|
||||
@@ -37,7 +37,6 @@ class TestOutletTempControl(base.BaseTestCase):
|
||||
super(TestOutletTempControl, self).setUp()
|
||||
# fake metrics
|
||||
self.fake_metrics = faker_metrics_collector.FakerMetricsCollector()
|
||||
|
||||
# fake cluster
|
||||
self.fake_cluster = faker_cluster_state.FakerModelCollector()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user