aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-01-19 15:46:11 +0000
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-03-01 10:54:30 +0000
commitd08a8d477fd7b9fb88855b12ee53eafa07e79afa (patch)
tree0331a4104aef22e858aba539b8665c95c7438e94 /tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
parentfe8bd59413e3525849f9b75752d657a737b5a0ad (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_prox_helpers.py')
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
index ac67cc52c..ce905182c 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py
@@ -24,6 +24,7 @@ import mock
import unittest
from tests.unit import STL_MOCKS
+from yardstick.common import utils
from yardstick.network_services.vnf_generic.vnf.base import VnfdHelper
@@ -962,7 +963,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
result = setup_helper.prox_config_data
self.assertEqual(result, expected)
- @mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
+ @mock.patch.object(utils, 'find_relative_file')
def test_build_config_file_no_additional_file(self, mock_find_path):
vnf1 = {
'prox_args': {'-c': ""},
@@ -996,7 +997,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
self.assertEqual(helper._prox_config_data, '4')
self.assertEqual(helper.remote_path, '5')
- @mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
+ @mock.patch.object(utils, 'find_relative_file')
def test_build_config_file_additional_file_string(self, mock_find_path):
vnf1 = {
'prox_args': {'-c': ""},
@@ -1028,7 +1029,7 @@ class TestProxDpdkVnfSetupEnvHelper(unittest.TestCase):
helper.build_config_file()
self.assertDictEqual(helper.additional_files, expected)
- @mock.patch('yardstick.network_services.vnf_generic.vnf.prox_helpers.find_relative_file')
+ @mock.patch.object(utils, 'find_relative_file')
def test_build_config_file_additional_file(self, mock_find_path):
vnf1 = {
'prox_args': {'-c': ""},