diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-01-19 15:46:11 +0000 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-03-01 10:54:30 +0000 |
commit | d08a8d477fd7b9fb88855b12ee53eafa07e79afa (patch) | |
tree | 0331a4104aef22e858aba539b8665c95c7438e94 /tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py | |
parent | fe8bd59413e3525849f9b75752d657a737b5a0ad (diff) |
Import "traffic_profile" modules only once
"traffic_profile" modules should be imported only once. Every time
TrafficProfile.get is called, the modules under
"yardstick.network_services.traffic_profiles" are loaded [1]. Instead
of this, the modules should be registered only once the first time
"yardstick.network_services.traffic_profiles.base" is loaded. This
will reduce the execution time and will avoid unnecessary calls.
[1] https://github.com/opnfv/yardstick/blob/d2c7cc4e9768ed003257a95c92cdb278d516761b/yardstick/network_services/traffic_profile/base.py#L36-L37
JIRA: YARDSTICK-951
Change-Id: Ia3565378ba3a1377fcb0aea8bda50ef8189414fd
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py')
-rw-r--r-- | tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py index f0a56665c..f2eca196f 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py @@ -22,6 +22,9 @@ import os from tests.unit import STL_MOCKS from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh +from yardstick.common import utils + + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) stl_patch.start() @@ -331,7 +334,7 @@ pipeline> vfw_approx_vnf._run() vfw_approx_vnf.ssh_helper.run.assert_called_once() - @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.find_relative_file") + @mock.patch.object(utils, 'find_relative_file') @mock.patch("yardstick.network_services.vnf_generic.vnf.vfw_vnf.YangModel") @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context") @mock.patch(SSH_HELPER) |