diff options
Diffstat (limited to 'tests/unit')
22 files changed, 48 insertions, 48 deletions
diff --git a/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py b/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py index d0a0d4e08..e39ecf4f2 100644 --- a/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py +++ b/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py @@ -65,7 +65,7 @@ class OvsDpdkContextTestCase(unittest.TestCase): self.ovs_dpdk.helper = mock_helper self.ovs_dpdk.vnf_node = mock_server self.assertIsNone(self.ovs_dpdk.file_path) - self.assertEqual(self.ovs_dpdk.first_run, True) + self.assertTrue(self.ovs_dpdk.first_run) def test_init(self): self.ovs_dpdk.helper.parse_pod_file = mock.Mock(return_value=[{}, {}, {}]) diff --git a/tests/unit/benchmark/contexts/standalone/test_sriov.py b/tests/unit/benchmark/contexts/standalone/test_sriov.py index 3ea673abc..7f11a7d59 100644 --- a/tests/unit/benchmark/contexts/standalone/test_sriov.py +++ b/tests/unit/benchmark/contexts/standalone/test_sriov.py @@ -70,7 +70,7 @@ class SriovContextTestCase(unittest.TestCase): self.sriov.helper = mock_helper self.sriov.vnf_node = mock_server self.assertIsNone(self.sriov.file_path) - self.assertEqual(self.sriov.first_run, True) + self.assertTrue(self.sriov.first_run) def test_init(self): self.sriov.helper.parse_pod_file = mock.Mock(return_value=[{}, {}, {}]) diff --git a/tests/unit/benchmark/scenarios/availability/test_monitor_command.py b/tests/unit/benchmark/scenarios/availability/test_monitor_command.py index abef1e8bb..b84cef23c 100644 --- a/tests/unit/benchmark/scenarios/availability/test_monitor_command.py +++ b/tests/unit/benchmark/scenarios/availability/test_monitor_command.py @@ -61,7 +61,7 @@ class MonitorOpenstackCmdTestCase(unittest.TestCase): instance.setup() mock_subprocess_check_output.return_value = (0, 'unittest') ret = instance.monitor_func() - self.assertEqual(ret, True) + self.assertTrue(ret) instance._result = {"outage_time": 0} instance.verify_SLA() @@ -72,7 +72,7 @@ class MonitorOpenstackCmdTestCase(unittest.TestCase): instance.setup() mock_subprocess_check_output.side_effect = RuntimeError ret = instance.monitor_func() - self.assertEqual(ret, False) + self.assertFalse(ret) mock_log.error.assert_called_once() instance._result = {"outage_time": 10} instance.verify_SLA() diff --git a/tests/unit/benchmark/scenarios/availability/test_serviceha.py b/tests/unit/benchmark/scenarios/availability/test_serviceha.py index 2b630da5a..97d534894 100644 --- a/tests/unit/benchmark/scenarios/availability/test_serviceha.py +++ b/tests/unit/benchmark/scenarios/availability/test_serviceha.py @@ -56,14 +56,14 @@ class ServicehaTestCase(unittest.TestCase): p = serviceha.ServiceHA(self.args, self.ctx) p.setup() - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) mock_monitor.MonitorMgr().verify_SLA.return_value = True ret = {} p.run(ret) p.teardown() p.setup() - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) # def test__serviceha_run_sla_error(self, mock_attacker, mock_monitor): # p = serviceha.ServiceHA(self.args, self.ctx) diff --git a/tests/unit/benchmark/scenarios/compute/test_cyclictest.py b/tests/unit/benchmark/scenarios/compute/test_cyclictest.py index dc52a80c7..51ffd2488 100644 --- a/tests/unit/benchmark/scenarios/compute/test_cyclictest.py +++ b/tests/unit/benchmark/scenarios/compute/test_cyclictest.py @@ -74,7 +74,7 @@ class CyclictestTestCase(unittest.TestCase): c.setup() self.assertIsNotNone(c.guest) self.assertIsNotNone(c.host) - self.assertEqual(c.setup_done, True) + self.assertTrue(c.setup_done) def test_cyclictest_successful_no_sla(self, mock_ssh): result = {} diff --git a/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py b/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py index 1f0ff3c29..fb55b809f 100644 --- a/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py +++ b/tests/unit/benchmark/scenarios/compute/test_qemumigrate.py @@ -71,7 +71,7 @@ class QemuMigrateTestCase(unittest.TestCase): q.setup() self.assertIsNotNone(q.host) - self.assertEqual(q.setup_done, True) + self.assertTrue(q.setup_done) def test_qemu_migrate_successful_no_sla(self, mock_ssh): result = {} diff --git a/tests/unit/benchmark/scenarios/compute/test_unixbench.py b/tests/unit/benchmark/scenarios/compute/test_unixbench.py index 7d071e91c..fec355b45 100644 --- a/tests/unit/benchmark/scenarios/compute/test_unixbench.py +++ b/tests/unit/benchmark/scenarios/compute/test_unixbench.py @@ -40,7 +40,7 @@ class UnixbenchTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '', '') self.assertIsNotNone(u.client) - self.assertEqual(u.setup_done, True) + self.assertTrue(u.setup_done) def test_unixbench_successful_no_sla(self, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/dummy/test_dummy.py b/tests/unit/benchmark/scenarios/dummy/test_dummy.py index 560675d09..bc5131806 100644 --- a/tests/unit/benchmark/scenarios/dummy/test_dummy.py +++ b/tests/unit/benchmark/scenarios/dummy/test_dummy.py @@ -24,11 +24,11 @@ class DummyTestCase(unittest.TestCase): self.assertIsNone(self.test_context.scenario_cfg) self.assertIsNone(self.test_context.context_cfg) - self.assertEqual(self.test_context.setup_done, False) + self.assertFalse(self.test_context.setup_done) def test_run(self): result = {} self.test_context.run(result) self.assertEqual(result["hello"], "yardstick") - self.assertEqual(self.test_context.setup_done, True) + self.assertTrue(self.test_context.setup_done) diff --git a/tests/unit/benchmark/scenarios/lib/test_check_numa_info.py b/tests/unit/benchmark/scenarios/lib/test_check_numa_info.py index 45fbae45b..1dd461d41 100644 --- a/tests/unit/benchmark/scenarios/lib/test_check_numa_info.py +++ b/tests/unit/benchmark/scenarios/lib/test_check_numa_info.py @@ -38,7 +38,7 @@ class CheckNumaInfoTestCase(unittest.TestCase): scenario_cfg = {'info1': info1, 'info2': info2} obj = CheckNumaInfo(scenario_cfg, {}) status = obj._check_vm2_status(info1, info2) - self.assertEqual(status, True) + self.assertTrue(status) def test_check_vm2_status_length_gt_1(self): info1 = { @@ -56,7 +56,7 @@ class CheckNumaInfoTestCase(unittest.TestCase): scenario_cfg = {'info1': info1, 'info2': info2} obj = CheckNumaInfo(scenario_cfg, {}) status = obj._check_vm2_status(info1, info2) - self.assertEqual(status, False) + self.assertFalse(status) def test_check_vm2_status_length_not_in_set(self): info1 = { @@ -74,7 +74,7 @@ class CheckNumaInfoTestCase(unittest.TestCase): scenario_cfg = {'info1': info1, 'info2': info2} obj = CheckNumaInfo(scenario_cfg, {}) status = obj._check_vm2_status(info1, info2) - self.assertEqual(status, False) + self.assertFalse(status) def main(): diff --git a/tests/unit/benchmark/scenarios/networking/test_netperf.py b/tests/unit/benchmark/scenarios/networking/test_netperf.py index d0f862fb5..d82a00931 100755 --- a/tests/unit/benchmark/scenarios/networking/test_netperf.py +++ b/tests/unit/benchmark/scenarios/networking/test_netperf.py @@ -48,7 +48,7 @@ class NetperfTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.server) self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_netperf_successful_no_sla(self, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/networking/test_netperf_node.py b/tests/unit/benchmark/scenarios/networking/test_netperf_node.py index 62874cc44..8be9bb94d 100755 --- a/tests/unit/benchmark/scenarios/networking/test_netperf_node.py +++ b/tests/unit/benchmark/scenarios/networking/test_netperf_node.py @@ -48,7 +48,7 @@ class NetperfNodeTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.server) self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_netperf_node_successful_no_sla(self, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/networking/test_nstat.py b/tests/unit/benchmark/scenarios/networking/test_nstat.py index 84b559812..4b58e06c1 100644 --- a/tests/unit/benchmark/scenarios/networking/test_nstat.py +++ b/tests/unit/benchmark/scenarios/networking/test_nstat.py @@ -39,7 +39,7 @@ class NstatTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '', '') self.assertIsNotNone(n.client) - self.assertEqual(n.setup_done, True) + self.assertTrue(n.setup_done) def test_nstat_successful_no_sla(self, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/networking/test_ping6.py b/tests/unit/benchmark/scenarios/networking/test_ping6.py index ecce7cee5..d2be6f576 100644 --- a/tests/unit/benchmark/scenarios/networking/test_ping6.py +++ b/tests/unit/benchmark/scenarios/networking/test_ping6.py @@ -59,7 +59,7 @@ class PingTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '0', '') p.setup() - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh') def test_ping_successful_no_sla(self, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen.py b/tests/unit/benchmark/scenarios/networking/test_pktgen.py index 71d20e5fe..005b53177 100644 --- a/tests/unit/benchmark/scenarios/networking/test_pktgen.py +++ b/tests/unit/benchmark/scenarios/networking/test_pktgen.py @@ -50,7 +50,7 @@ class PktgenTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '', '') self.assertIsNotNone(p.server) self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_pktgen_successful_iptables_setup(self, mock_ssh): diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py b/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py index 19c84e855..c9eec4b94 100644 --- a/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py +++ b/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk.py @@ -61,7 +61,7 @@ class PktgenDPDKLatencyTestCase(unittest.TestCase): self.mock_ssh.SSH.from_node().execute.return_value = (0, '', '') self.assertIsNotNone(p.server) self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_pktgen_dpdk_successful_get_port_ip(self): diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py b/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py index 8ac0763ba..c2e35af75 100644 --- a/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py +++ b/tests/unit/benchmark/scenarios/networking/test_pktgen_dpdk_throughput.py @@ -55,7 +55,7 @@ class PktgenDPDKTestCase(unittest.TestCase): mock_ssh.SSH().execute.return_value = (0, '', '') self.assertIsNotNone(p.server) self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_pktgen_dpdk_throughput_successful_no_sla(self, mock_ssh): args = { @@ -172,7 +172,7 @@ class PktgenDPDKTestCase(unittest.TestCase): p.dpdk_setup() - self.assertEqual(p.dpdk_setup_done, True) + self.assertTrue(p.dpdk_setup_done) def test_pktgen_dpdk_throughput_dpdk_get_result(self, mock_ssh): args = { diff --git a/tests/unit/benchmark/scenarios/networking/test_vsperf.py b/tests/unit/benchmark/scenarios/networking/test_vsperf.py index cbbfc2b34..be8ac55d0 100644 --- a/tests/unit/benchmark/scenarios/networking/test_vsperf.py +++ b/tests/unit/benchmark/scenarios/networking/test_vsperf.py @@ -66,7 +66,7 @@ class VsperfTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_vsperf_teardown(self, mock_ssh, mock_subprocess): p = vsperf.Vsperf(self.args, self.ctx) @@ -77,10 +77,10 @@ class VsperfTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) p.teardown() - self.assertEqual(p.setup_done, False) + self.assertFalse(p.setup_done) def test_vsperf_run_ok(self, mock_ssh, mock_subprocess): p = vsperf.Vsperf(self.args, self.ctx) diff --git a/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py b/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py index ab3d815c5..fbe3ed804 100644 --- a/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py +++ b/tests/unit/benchmark/scenarios/networking/test_vsperf_dpdk.py @@ -79,7 +79,7 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_vsperf_dpdk_teardown(self, mock_subprocess): p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx) @@ -89,10 +89,10 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) p.teardown() - self.assertEqual(p.setup_done, False) + self.assertFalse(p.setup_done) def test_vsperf_dpdk_is_dpdk_setup_no(self, mock_subprocess): p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx) @@ -102,13 +102,13 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) # is_dpdk_setup() specific mocks self.mock_ssh.SSH.from_node().execute.return_value = (0, 'dummy', '') result = p._is_dpdk_setup() - self.assertEqual(result, False) + self.assertFalse(result) def test_vsperf_dpdk_is_dpdk_setup_yes(self, mock_subprocess): p = vsperf_dpdk.VsperfDPDK(self.args, self.ctx) @@ -118,13 +118,13 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) # is_dpdk_setup() specific mocks self.mock_ssh.SSH.from_node().execute.return_value = (0, '', '') result = p._is_dpdk_setup() - self.assertEqual(result, True) + self.assertTrue(result) @mock.patch('time.sleep') def test_vsperf_dpdk_dpdk_setup_first(self, _, mock_subprocess): @@ -135,14 +135,14 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) # is_dpdk_setup() specific mocks self.mock_ssh.SSH.from_node().execute.return_value = (0, 'dummy', '') p.dpdk_setup() - self.assertEqual(p._is_dpdk_setup(), False) - self.assertEqual(p.dpdk_setup_done, True) + self.assertFalse(p._is_dpdk_setup()) + self.assertTrue(p.dpdk_setup_done) @mock.patch('time.sleep') def test_vsperf_dpdk_dpdk_setup_next(self, _, mock_subprocess): @@ -154,11 +154,11 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) p.dpdk_setup() - self.assertEqual(p._is_dpdk_setup(), True) - self.assertEqual(p.dpdk_setup_done, True) + self.assertTrue(p._is_dpdk_setup()) + self.assertTrue(p.dpdk_setup_done) @mock.patch('time.sleep') def test_vsperf_dpdk_dpdk_setup_fail(self, _, mock_subprocess): @@ -171,7 +171,7 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) self.mock_ssh.SSH.from_node().execute.return_value = (1, '', '') - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) self.assertRaises(RuntimeError, p.dpdk_setup) @@ -185,7 +185,7 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) # run() specific mocks mock_subprocess.call().execute.return_value = None @@ -206,7 +206,7 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) # run() specific mocks mock_subprocess.call().execute.return_value = None @@ -225,7 +225,7 @@ class VsperfDPDKTestCase(unittest.TestCase): p.setup() self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) # run() specific mocks mock_subprocess.call().execute.return_value = None diff --git a/tests/unit/benchmark/scenarios/parser/test_parser.py b/tests/unit/benchmark/scenarios/parser/test_parser.py index 73d67f01f..014d724a5 100644 --- a/tests/unit/benchmark/scenarios/parser/test_parser.py +++ b/tests/unit/benchmark/scenarios/parser/test_parser.py @@ -32,7 +32,7 @@ class ParserTestCase(unittest.TestCase): p = parser.Parser({}, {}) mock_subprocess.call().return_value = 0 p.setup() - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_parser_successful(self, mock_subprocess): args = { @@ -52,7 +52,7 @@ class ParserTestCase(unittest.TestCase): p = parser.Parser({}, {}) mock_subprocess.call().return_value = 0 p.teardown() - self.assertEqual(p.teardown_done, True) + self.assertTrue(p.teardown_done) def main(): diff --git a/tests/unit/benchmark/scenarios/storage/test_fio.py b/tests/unit/benchmark/scenarios/storage/test_fio.py index 17594b9f4..0cffea224 100644 --- a/tests/unit/benchmark/scenarios/storage/test_fio.py +++ b/tests/unit/benchmark/scenarios/storage/test_fio.py @@ -53,7 +53,7 @@ class FioTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '', '') self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_fio_job_file_successful_setup(self, mock_ssh): @@ -67,7 +67,7 @@ class FioTestCase(unittest.TestCase): mock_ssh.SSH.from_node().execute.return_value = (0, '', '') self.assertIsNotNone(p.client) - self.assertEqual(p.setup_done, True) + self.assertTrue(p.setup_done) def test_fio_successful_no_sla(self, mock_ssh): diff --git a/tests/unit/network_services/nfvi/test_resource.py b/tests/unit/network_services/nfvi/test_resource.py index 2f953f227..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"), 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 8bf589281..8fe0244bb 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() |