diff options
Diffstat (limited to 'yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py')
-rw-r--r-- | yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py index f581ec8d9..050aa4aa0 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py @@ -18,6 +18,7 @@ import mock from yardstick.tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh from yardstick.tests import STL_MOCKS +from yardstick.benchmark.contexts import base as ctx_base SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' @@ -324,15 +325,22 @@ class TestProxTrafficGen(unittest.TestCase): self.assertIsNone(prox_traffic_gen._tg_process) self.assertIsNone(prox_traffic_gen._traffic_process) + @mock.patch.object(ctx_base.Context, 'get_physical_node_from_server', return_value='mock_node') @mock.patch(SSH_HELPER) def test_collect_kpi(self, ssh, *args): mock_ssh(ssh) - prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0) + prox_traffic_gen.scenario_helper.scenario_cfg = { + 'nodes': {prox_traffic_gen.name: "mock"} + } prox_traffic_gen._vnf_wrapper.resource_helper.resource = mock.MagicMock( **{"self.check_if_system_agent_running.return_value": [False]}) prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="") - self.assertEqual({}, prox_traffic_gen.collect_kpi()) + expected = { + 'collect_stats': {}, + 'physical_node': 'mock_node' + } + self.assertEqual(prox_traffic_gen.collect_kpi(), expected) @mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file') |