From bd11ffdec1f18785696b5c4872e5bd5e1012249c Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Tue, 5 Sep 2017 15:38:52 -0700 Subject: collectd: write config file from Jinja2 template We have the collectd.conf inside the python package so instead of copying it from various places, write the template directly to the remote system. collectd: read collect.conf template with pkgresources read the collectd.conf file as a string directly and upload without creating temp file use Jinja2 template, disable failing plugins use proper Jinja2 template, disable the plugins that were failing to load and blocking startup add support for per-testcase collectd.conf config using YAML add support for custom interval, default is 25 seconds Change-Id: Id904f7b7c9f41a9dd7adf5dfa06c064d65c25d2d Signed-off-by: Ross Brattain --- tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/unit/network_services/vnf_generic/vnf') diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py index 4b9f4172e..d0c4b6f42 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py @@ -723,8 +723,9 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase): result = dpdk_setup_helper._validate_cpu_cfg() self.assertEqual(result, expected) + @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time') @mock.patch('yardstick.ssh.SSH') - def test_setup_vnf_environment(self, _): + def test_setup_vnf_environment(self, _, mock_time): def execute(cmd, *args, **kwargs): if cmd.startswith('which '): return exec_failure @@ -782,6 +783,8 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase): dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper) dpdk_setup_helper._validate_cpu_cfg = mock.Mock() + dpdk_setup_helper.bound_pci = [v['virtual-interface']["vpci"] for v in + vnfd_helper.interfaces] result = dpdk_setup_helper._setup_resources() self.assertIsInstance(result, ResourceProfile) self.assertEqual(dpdk_setup_helper.socket, 0) @@ -796,11 +799,14 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase): dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper) dpdk_setup_helper._validate_cpu_cfg = mock.Mock() + dpdk_setup_helper.bound_pci = [v['virtual-interface']["vpci"] for v in + vnfd_helper.interfaces] result = dpdk_setup_helper._setup_resources() self.assertIsInstance(result, ResourceProfile) self.assertEqual(dpdk_setup_helper.socket, 1) - def test__detect_and_bind_drivers(self): + @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time') + def test__detect_and_bind_drivers(self, mock_time): vnfd_helper = VnfdHelper(deepcopy(self.VNFD_0)) ssh_helper = mock.Mock() # ssh_helper.execute = mock.Mock(return_value = (0, 'text', '')) -- cgit 1.2.3-korg