How to use get_buddy_info method in avocado

Best Python code snippet using avocado_python

test_utils_memory.py

Source:test_utils_memory.py Github

copy

Full Screen

...17 return_value=BUDDY_INFO_RESPONSE)18class GetBuddyInfo(unittest.TestCase):19 def test_simple_chunk_size(self, buddy_mocked):20 chunk_size = '0'21 result = memory.get_buddy_info(chunk_size)22 self.assertEqual(result[chunk_size], 6418)23 self.assertTrue(buddy_mocked.called)24 def test_less_than_chunk_size(self, buddy_mocked):25 chunk_size = '<2'26 result = memory.get_buddy_info(chunk_size)27 self.assertEqual(result['0'], 6418)28 self.assertEqual(result['1'], 10439)29 self.assertTrue(buddy_mocked.called)30 def test_less_than_equal_chunk_size(self, buddy_mocked):31 chunk_size = '<=2'32 result = memory.get_buddy_info(chunk_size)33 self.assertEqual(result['0'], 6418)34 self.assertEqual(result['1'], 10439)35 self.assertEqual(result['2'], 10048)36 self.assertTrue(buddy_mocked.called)37 def test_greater_than_chunk_size(self, buddy_mocked):38 chunk_size = '>3'39 result = memory.get_buddy_info(chunk_size)40 self.assertEqual(result['4'], 19278)41 self.assertEqual(result['5'], 10357)42 self.assertTrue(buddy_mocked.called)43 def test_greater_than_equal_chunk_size(self, buddy_mocked):44 chunk_size = '>=3'45 result = memory.get_buddy_info(chunk_size)46 self.assertEqual(result['3'], 12819)47 self.assertEqual(result['4'], 19278)48 self.assertEqual(result['5'], 10357)49 self.assertTrue(buddy_mocked.called)50 def test_multiple_chunk_size(self, buddy_mocked):51 chunk_size = '2 4'52 result = memory.get_buddy_info(chunk_size)53 self.assertEqual(result['2'], 10048)54 self.assertEqual(result['4'], 19278)55 self.assertTrue(buddy_mocked.called)56 def test_multiple_chunk_size_filtering_simple(self, buddy_mocked):57 chunk_size = '>2 <4'58 result = memory.get_buddy_info(chunk_size)59 self.assertEqual(result['3'], 12819)60 self.assertTrue(buddy_mocked.called)61 def test_multiple_chunk_size_filtering(self, buddy_mocked):62 chunk_size = '>=2 <=4'63 result = memory.get_buddy_info(chunk_size)64 self.assertEqual(result['2'], 10048)65 self.assertEqual(result['3'], 12819)66 self.assertEqual(result['4'], 19278)67 self.assertTrue(buddy_mocked.called)68 def test_multiple_chunk_size_filtering_invalid(self, buddy_mocked):69 chunk_size = '>2 <2'70 result = memory.get_buddy_info(chunk_size)71 self.assertEqual(result, {})72 self.assertTrue(buddy_mocked.called)73 def test_filtering_node(self, buddy_mocked):74 chunk_size = '0'75 result = memory.get_buddy_info(chunk_size, nodes='1')76 self.assertEqual(result[chunk_size], 5430)77 self.assertTrue(buddy_mocked.called)78 def test_filtering_zone(self, buddy_mocked):79 chunk_size = '0'80 result = memory.get_buddy_info(chunk_size, zones='DMA32')81 self.assertEqual(result[chunk_size], 987)82 self.assertTrue(buddy_mocked.called)83if __name__ == '__main__':...

Full Screen

Full Screen

balloon_thp.py

Source:balloon_thp.py Github

copy

Full Screen

...21 :param test: QEMU test object22 :param params: Dictionary with the test parameters23 :param env: Dictionary with test environment.24 """25 def get_buddy_info(sleep=False):26 """Get buddy info"""27 if sleep:28 time.sleep(10)29 buddy_info = utils_memory.get_buddy_info('0', session=session)['0']30 logging.info('Checked buddy info, value is %s', buddy_info)31 return buddy_info32 fragement_dir = params['fragement_dir']33 vm = env.get_vm(params["main_vm"])34 session = vm.wait_for_login()35 buddy_info_bf = get_buddy_info()36 logging.info('Making fragement on guest...')37 session.cmd_output_safe(params['cmd_make_fragement'], timeout=600)38 for i in range(1, 10, 2):39 session.cmd_output_safe('rm -f %s/*%s' % (fragement_dir, i))40 funcatexit.register(env, params['type'], clean_env, session, fragement_dir)41 buddy_info_af_fragement = get_buddy_info(sleep=True)42 if buddy_info_bf >= buddy_info_af_fragement:43 test.fail('Buddy info should increase.')44 mem = int(float(utils_misc.normalize_data_size("%sM" % params["mem"])))45 vm.balloon(mem - 1024)46 buddy_info_af_balloon = get_buddy_info(sleep=True)47 if buddy_info_af_balloon >= buddy_info_af_fragement:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful