def test_os_type_check(self, mock_linux_distribution): # 1 - server and agent os compatible mock_linux_distribution.return_value = ('aaa', '11', 'bb') base_args = ["os_check_type.py", "aaa11"] sys.argv = list(base_args) try: os_check_type.main() except SystemExit as e: # exit_code=0 self.assertEquals("0", str(e)) # 2 - server and agent os is not compatible mock_linux_distribution.return_value = ('ddd', '33', 'bb') base_args = ["os_check_type.py", "zzz_x77"] sys.argv = list(base_args) try: os_check_type.main() self.fail("Must fail because os's not compatible.") except Exception as e: self.assertEquals( "Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.", str(e)) pass
def test_os_type_check(self, mock_linux_distribution): # 1 - server and agent os compatible mock_linux_distribution.return_value = ('aaa', '11', 'bb') base_args = ["os_check_type.py", "aaa11"] sys.argv = list(base_args) try: os_check_type.main() except SystemExit as e: # exit_code=0 self.assertEquals("0", str(e)) # 2 - server and agent os is not compatible mock_linux_distribution.return_value = ('ddd', '33', 'bb') base_args = ["os_check_type.py", "zzz_x77"] sys.argv = list(base_args) try: os_check_type.main() self.fail("Must fail because os's not compatible.") except Exception as e: self.assertEquals( "Local OS is not compatible with cluster primary OS. Please perform manual bootstrap on this host.", str(e)) pass