diff options
Diffstat (limited to 'tests/unit/network_services')
5 files changed, 22 insertions, 25 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..7ad166249 100644 --- a/tests/unit/network_services/nfvi/test_resource.py +++ b/tests/unit/network_services/nfvi/test_resource.py @@ -102,7 +102,7 @@ class TestResourceProfile(unittest.TestCase): self.resource_profile.connection = self.ssh_mock def test___init__(self): - self.assertEqual(True, self.resource_profile.enable) + self.assertTrue(self.resource_profile.enable) def test_check_if_system_agent_running(self): self.assertEqual(self.resource_profile.check_if_system_agent_running("collectd"), @@ -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..fb26f20b5 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 @@ -80,7 +80,7 @@ class TestPingParser(unittest.TestCase): ping_parser = PingParser(q_out) ping_parser.write(sample_out) ping_parser.clear() - self.assertEqual(True, q_out.empty()) + self.assertTrue(q_out.empty()) def test_close(self): q_out = Queue() @@ -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') |