From d064ab0bffd429382ea4fafeb144784d403848bd Mon Sep 17 00:00:00 2001 From: Ɓukasz 'sil2100' Zemczak Date: Mon, 16 Jan 2017 10:10:41 +0100 Subject: Import patches-unapplied version 2.2.2-0ubuntu1 to ubuntu/zesty-proposed Imported using git-ubuntu import. Changelog parent: 63d399807de30a64456e672063e7c20babf7aadc New changelog entries: * New upstream release (LP: #1651128) - d/patches/fix-auto-update.patch, d/patches/lp1623570-adjust-walinuxagent-service-after-and-wants.patch: - Dropped as changes have been applied upstream - Refreshed debian/patches/disable_import_test.patch --- tests/common/osutil/test_default.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/common/osutil/test_default.py') diff --git a/tests/common/osutil/test_default.py b/tests/common/osutil/test_default.py index d9d00f6..d982b7e 100644 --- a/tests/common/osutil/test_default.py +++ b/tests/common/osutil/test_default.py @@ -142,5 +142,27 @@ class TestOSUtil(AgentTestCase): self.assertTrue(endpoint is not None) self.assertEqual(endpoint, "second") + def test_get_total_mem(self): + """ + Validate the returned value matches to the one retrieved by invoking shell command + """ + cmd = "grep MemTotal /proc/meminfo |awk '{print $2}'" + ret = shellutil.run_get_output(cmd) + if ret[0] == 0: + self.assertEqual(int(ret[1]) / 1024, get_osutil().get_total_mem()) + else: + self.fail("Cannot retrieve total memory using shell command.") + + def test_get_processor_cores(self): + """ + Validate the returned value matches to the one retrieved by invoking shell command + """ + cmd = "grep 'processor.*:' /proc/cpuinfo |wc -l" + ret = shellutil.run_get_output(cmd) + if ret[0] == 0: + self.assertEqual(int(ret[1]), get_osutil().get_processor_cores()) + else: + self.fail("Cannot retrieve number of process cores using shell command.") + if __name__ == '__main__': unittest.main() -- cgit v1.2.3