diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc080.yaml | 5 | ||||
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc081.yaml | 6 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/test_model.py | 20 |
3 files changed, 14 insertions, 17 deletions
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc080.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc080.yaml index 503fe6a45..0da296297 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc080.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc080.yaml @@ -8,10 +8,11 @@ ############################################################################## --- -# Sample benchmark task config file -# measure network latency using ping in container schema: "yardstick:task:0.1" +description: > + Yardstick TC080 config file; + measure network latency between containers in k8s using ping; scenarios: - diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc081.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc081.yaml index d99757e47..0d79a41ed 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc081.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc081.yaml @@ -8,10 +8,12 @@ ############################################################################## --- -# Sample benchmark task config file -# measure network latency using ping betwwen container and VM schema: "yardstick:task:0.1" +description: > + Yardstick TC081 config file; + measure network latency between container and VM using ping; + scenarios: - diff --git a/tests/unit/benchmark/contexts/standalone/test_model.py b/tests/unit/benchmark/contexts/standalone/test_model.py index ddbc1a4bb..6899a0af6 100644 --- a/tests/unit/benchmark/contexts/standalone/test_model.py +++ b/tests/unit/benchmark/contexts/standalone/test_model.py @@ -91,10 +91,12 @@ class ModelLibvirtTestCase(unittest.TestCase): image = Libvirt.create_snapshot_qemu(ssh_mock, "0", "ubuntu.img") self.assertEqual(image, result) + @mock.patch("yardstick.benchmark.contexts.standalone.model.Libvirt.pin_vcpu_for_perf") @mock.patch("yardstick.benchmark.contexts.standalone.model.Libvirt.create_snapshot_qemu") @mock.patch('yardstick.benchmark.contexts.standalone.model.open') @mock.patch('yardstick.benchmark.contexts.standalone.model.write_file') - def test_build_vm_xml(self, mock_open, mock_write_file, mock_create_snapshot_qemu): + def test_build_vm_xml(self, mock_open, mock_write_file, mock_create_snapshot_qemu, + mock_pin_vcpu_for_perf): result = [4] with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) @@ -102,17 +104,10 @@ class ModelLibvirtTestCase(unittest.TestCase): mock.Mock(return_value=(0, "a", "")) ssh.return_value = ssh_mock mock_create_snapshot_qemu.return_value = "0.img" + status = Libvirt.build_vm_xml(ssh_mock, {}, "test", "vm_0", 0) self.assertEqual(status[0], result[0]) - def test_split_cpu_list(self): - result = Libvirt.split_cpu_list("1,2,3") - self.assertEqual(result, [1, 2, 3]) - - def test_get_numa_nodes(self): - result = Libvirt.get_numa_nodes() - self.assertIsNotNone(result) - def test_update_interrupts_hugepages_perf(self): with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) @@ -122,17 +117,16 @@ class ModelLibvirtTestCase(unittest.TestCase): status = Libvirt.update_interrupts_hugepages_perf(ssh_mock) self.assertIsNone(status) - @mock.patch("yardstick.benchmark.contexts.standalone.model.Libvirt.get_numa_nodes") + @mock.patch("yardstick.benchmark.contexts.standalone.model.CpuSysCores") @mock.patch("yardstick.benchmark.contexts.standalone.model.Libvirt.update_interrupts_hugepages_perf") - def test_pin_vcpu_for_perf(self, mock_update_interrupts_hugepages_perf, mock_get_numa_nodes): + def test_pin_vcpu_for_perf(self, mock_update_interrupts_hugepages_perf, mock_CpuSysCores): with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) ssh_mock.execute = \ mock.Mock(return_value=(0, "a", "")) ssh.return_value = ssh_mock - mock_get_numa_nodes.return_value = {'1': [18, 19, 20, 21], '0': [0, 1, 2, 3]} status = Libvirt.pin_vcpu_for_perf(ssh_mock, "vm_0", 4) - self.assertIsNone(status) + self.assertIsNotNone(status) class StandaloneContextHelperTestCase(unittest.TestCase): |