aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2018-01-26 21:12:01 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-01-26 21:12:01 +0000
commite6b6f6fca60322f57329d1c93a01c88c3c81b62c (patch)
tree4bceaafce8756246a9e2b46d5ddb791144b3462b /tests/unit/network_services
parent868db57177cdbbebf8d160ca049cdf81fda3a2f4 (diff)
parent298e2e529e815f31c7ae5e0e1154a7fdac92a067 (diff)
Merge changes from topic 'bug/yardstick-864'
* changes: Replace assertEquals with assertEqual Make files pep8 compliant before using assertTrue|False
Diffstat (limited to 'tests/unit/network_services')
-rw-r--r--tests/unit/network_services/helpers/test_dpdkbindnic_helper.py21
-rw-r--r--tests/unit/network_services/nfvi/test_resource.py11
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py4
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py5
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py2
5 files changed, 20 insertions, 23 deletions
diff --git a/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py b/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py
index 0f1cf7d92..9bb5ed3a7 100644
--- a/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py
+++ b/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py
@@ -25,8 +25,6 @@ from yardstick.network_services.helpers.dpdkbindnic_helper import CRYPTO_DPDK
from yardstick.network_services.helpers.dpdkbindnic_helper import NETWORK_OTHER
from yardstick.network_services.helpers.dpdkbindnic_helper import CRYPTO_OTHER
-pass
-
class TestDpdkBindHelper(unittest.TestCase):
EXAMPLE_OUTPUT = """
@@ -116,8 +114,8 @@ Other crypto devices
dpdk_bind_helper = DpdkBindHelper(conn)
- self.assertEquals(conn, dpdk_bind_helper.ssh_helper)
- self.assertEquals(self.CLEAN_STATUS, dpdk_bind_helper.dpdk_status)
+ self.assertEqual(conn, dpdk_bind_helper.ssh_helper)
+ self.assertEqual(self.CLEAN_STATUS, dpdk_bind_helper.dpdk_status)
self.assertIsNone(dpdk_bind_helper.status_nic_row_re)
self.assertIsNone(dpdk_bind_helper._dpdk_nic_bind_attr)
self.assertIsNone(dpdk_bind_helper._status_cmd_attr)
@@ -127,7 +125,8 @@ Other crypto devices
conn.execute = mock.Mock(return_value=(0, 'output', 'error'))
conn.provision_tool = mock.Mock(return_value='tool_path')
dpdk_bind_helper = DpdkBindHelper(conn)
- self.assertEquals((0, 'output', 'error'), dpdk_bind_helper._dpdk_execute('command'))
+ self.assertEqual((0, 'output', 'error'),
+ dpdk_bind_helper._dpdk_execute('command'))
def test__dpdk_execute_failure(self):
conn = mock.Mock()
@@ -145,7 +144,7 @@ Other crypto devices
dpdk_bind_helper._addline(NETWORK_KERNEL, self.ONE_INPUT_LINE)
self.assertIsNotNone(dpdk_bind_helper.dpdk_status)
- self.assertEquals(self.ONE_INPUT_LINE_PARSED, dpdk_bind_helper.dpdk_status[NETWORK_KERNEL])
+ self.assertEqual(self.ONE_INPUT_LINE_PARSED, dpdk_bind_helper.dpdk_status[NETWORK_KERNEL])
def test__switch_active_dict_by_header(self):
line = "Crypto devices using DPDK-compatible driver"
@@ -165,7 +164,7 @@ Other crypto devices
dpdk_bind_helper.parse_dpdk_status_output(self.EXAMPLE_OUTPUT)
self.maxDiff = None
- self.assertEquals(self.PARSED_EXAMPLE, dpdk_bind_helper.dpdk_status)
+ self.assertEqual(self.PARSED_EXAMPLE, dpdk_bind_helper.dpdk_status)
def test_read_status(self):
conn = mock.Mock()
@@ -174,7 +173,7 @@ Other crypto devices
dpdk_bind_helper = DpdkBindHelper(conn)
- self.assertEquals(self.PARSED_EXAMPLE, dpdk_bind_helper.read_status())
+ self.assertEqual(self.PARSED_EXAMPLE, dpdk_bind_helper.read_status())
def test__get_bound_pci_addresses(self):
conn = mock.Mock()
@@ -183,9 +182,9 @@ Other crypto devices
dpdk_bind_helper.parse_dpdk_status_output(self.EXAMPLE_OUTPUT)
- self.assertEquals(['0000:00:04.0', '0000:00:05.0'],
+ self.assertEqual(['0000:00:04.0', '0000:00:05.0'],
dpdk_bind_helper._get_bound_pci_addresses(NETWORK_DPDK))
- self.assertEquals(['0000:00:03.0'],
+ self.assertEqual(['0000:00:03.0'],
dpdk_bind_helper._get_bound_pci_addresses(NETWORK_KERNEL))
def test_interface_driver_map(self):
@@ -195,7 +194,7 @@ Other crypto devices
dpdk_bind_helper.parse_dpdk_status_output(self.EXAMPLE_OUTPUT)
- self.assertEquals({'0000:00:04.0': 'igb_uio',
+ self.assertEqual({'0000:00:04.0': 'igb_uio',
'0000:00:03.0': 'virtio-pci',
'0000:00:05.0': 'igb_uio',
},
diff --git a/tests/unit/network_services/nfvi/test_resource.py b/tests/unit/network_services/nfvi/test_resource.py
index 4584b093d..2f953f227 100644
--- a/tests/unit/network_services/nfvi/test_resource.py
+++ b/tests/unit/network_services/nfvi/test_resource.py
@@ -136,11 +136,12 @@ class TestResourceProfile(unittest.TestCase):
self.resource_profile._prepare_collectd_conf("/opt/nsb_bin"))
def test__setup_ovs_stats(self):
+ # TODO(elfoley): This method doesn't actually return anything, the side
+ # effects should be checked
self.assertIsNone(
self.resource_profile._setup_ovs_stats(self.ssh_mock))
- @mock.patch("yardstick.network_services.nfvi.resource.open")
- def test__provide_config_file(self, *args):
+ def test__provide_config_file(self,):
loadplugin = range(5)
port_names = range(5)
kwargs = {
@@ -151,14 +152,12 @@ class TestResourceProfile(unittest.TestCase):
self.resource_profile._provide_config_file("/opt/nsb_bin", "collectd.conf", kwargs)
self.ssh_mock.execute.assert_called_once()
- @mock.patch("yardstick.network_services.nfvi.resource.open")
- def test_initiate_systemagent(self, *args):
+ def test_initiate_systemagent(self):
self.resource_profile._start_collectd = mock.Mock()
self.assertIsNone(
self.resource_profile.initiate_systemagent("/opt/nsb_bin"))
- @mock.patch("yardstick.network_services.nfvi.resource.open")
- def test_initiate_systemagent_raise(self, *args):
+ def test_initiate_systemagent_raise(self):
self.resource_profile._start_collectd = mock.Mock(side_effect=RuntimeError)
with self.assertRaises(RuntimeError):
self.resource_profile.initiate_systemagent("/opt/nsb_bin")
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 beb4f8f9f..af941c04f 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
@@ -704,8 +704,8 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
intf_0 = vnfd_helper.vdu[0]['external-interface'][0]['virtual-interface']
intf_1 = vnfd_helper.vdu[0]['external-interface'][1]['virtual-interface']
- self.assertEquals(0, intf_0['dpdk_port_num'])
- self.assertEquals(1, intf_1['dpdk_port_num'])
+ self.assertEqual(0, intf_0['dpdk_port_num'])
+ self.assertEqual(1, intf_1['dpdk_port_num'])
def test_tear_down(self):
vnfd_helper = VnfdHelper(self.VNFD_0)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
index 63b2ac4ab..f8ff60288 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
@@ -238,7 +238,7 @@ class TestPingTrafficGen(unittest.TestCase):
self.assertIsInstance(ping_traffic_gen.setup_helper, PingSetupEnvHelper)
self.assertIsInstance(ping_traffic_gen.resource_helper, PingResourceHelper)
- self.assertEquals(ping_traffic_gen._result, {})
+ self.assertEqual(ping_traffic_gen._result, {})
@mock.patch("yardstick.ssh.SSH")
def test__bind_device_kernel_with_failure(self, ssh):
@@ -282,8 +282,7 @@ class TestPingTrafficGen(unittest.TestCase):
self.assertEqual(self.CMD_KWARGS, ping_traffic_gen.resource_helper.cmd_kwargs)
self.assertIsNotNone(ping_traffic_gen._result)
- @mock.patch("yardstick.ssh.SSH")
- def test_listen_traffic(self, *args):
+ def test_listen_traffic(self):
ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
self.assertIsNone(ping_traffic_gen.listen_traffic({}))
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
index 635ce2735..cda3852fe 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
@@ -447,7 +447,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
udp_replay_approx_vnf._vnf_process.is_alive = mock.Mock(return_value=1)
udp_replay_approx_vnf._vnf_process.exitcode = 0
- self.assertEquals(udp_replay_approx_vnf.wait_for_instantiate(), 0)
+ self.assertEqual(udp_replay_approx_vnf.wait_for_instantiate(), 0)
@mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
@mock.patch('yardstick.ssh.SSH')