diff options
author | Abhijit Sinha <abhijit.sinha@intel.com> | 2018-11-07 17:48:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-11-07 17:48:44 +0000 |
commit | b66cff80900ad2b14c96dd7100104318f0754f05 (patch) | |
tree | 23a7b9735f0d7fc7f955d47288214e6386f720fb /yardstick/tests/unit/common | |
parent | 372b3225b1ea632a2d889f10a0d853bc2224209c (diff) | |
parent | 7c7a14132588f99c6291da9037dc61d0d8ea935a (diff) |
Merge "Setup hugepages on SA host(sriov, ovs_dpdk)"
Diffstat (limited to 'yardstick/tests/unit/common')
-rw-r--r-- | yardstick/tests/unit/common/test_utils.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/yardstick/tests/unit/common/test_utils.py b/yardstick/tests/unit/common/test_utils.py index 3cf6c4d05..c0c928916 100644 --- a/yardstick/tests/unit/common/test_utils.py +++ b/yardstick/tests/unit/common/test_utils.py @@ -1407,3 +1407,20 @@ class SafeCaseTestCase(unittest.TestCase): def test_default_value(self): self.assertEqual(0, utils.safe_cast('', 'int', 0)) + + +class SetupHugepagesTestCase(unittest.TestCase): + + @mock.patch.object(six, 'BytesIO', return_value=six.BytesIO(b'5\n')) + @mock.patch.object(utils, 'read_meminfo', + return_value={'Hugepagesize': '1024'}) + def test_setup_hugepages(self, mock_meminfo, *args): + ssh = mock.Mock() + ssh.execute = mock.Mock() + hp_size_kb, hp_number, hp_number_set = utils.setup_hugepages(ssh, 10 * 1024) + mock_meminfo.assert_called_once_with(ssh) + ssh.execute.assert_called_once_with( + 'echo 10 | sudo tee /proc/sys/vm/nr_hugepages') + self.assertEqual(hp_size_kb, 1024) + self.assertEqual(hp_number, 10) + self.assertEqual(hp_number_set, 5) |