Przeglądaj źródła

AMBARI-10552. Several ambari-server python unit tests fail because OS type is not mocked

Sumit Mohanty 10 lat temu
rodzic
commit
a69d17fad8

+ 1 - 0
ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py

@@ -22,6 +22,7 @@ from stacks.utils.RMFTestCase import *
 import os
 
 origin_exists = os.path.exists
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(os.path, "exists", new=MagicMock(
   side_effect=lambda *args: origin_exists(args[0])
   if args[0][-2:] == "j2" else True))

+ 1 - 0
ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_client.py

@@ -22,6 +22,7 @@ from stacks.utils.RMFTestCase import *
 import os
 
 origin_exists = os.path.exists
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(os.path, "exists", new=MagicMock(
   side_effect=lambda *args: origin_exists(args[0])
   if args[0][-2:] == "j2" else True))

+ 1 - 0
ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_service_check.py

@@ -22,6 +22,7 @@ from stacks.utils.RMFTestCase import *
 import os
 
 origin_exists = os.path.exists
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(os.path, "exists", new=MagicMock(
   side_effect=lambda *args: origin_exists(args[0])
   if args[0][-2:] == "j2" else True))

+ 1 - 0
ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py

@@ -24,6 +24,7 @@ from resource_management.core import shell
 import os
 
 origin_exists = os.path.exists
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(os.path, "exists", new=MagicMock(
   side_effect=lambda *args: origin_exists(args[0])
   if args[0][-2:] == "j2" else True))

+ 1 - 0
ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py

@@ -22,6 +22,7 @@ from stacks.utils.RMFTestCase import *
 import os
 
 origin_exists = os.path.exists
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(os.path, "exists", new=MagicMock(
   side_effect=lambda *args: origin_exists(args[0])
   if args[0][-2:] == "j2" else True))

+ 1 - 0
ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py

@@ -23,6 +23,7 @@ from resource_management.libraries.script.script import Script
 import os
 
 origin_exists = os.path.exists
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(os.path, "exists", new=MagicMock(
   side_effect=lambda *args: origin_exists(args[0])
   if args[0][-2:] == "j2" else True))

+ 1 - 0
ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py

@@ -21,6 +21,7 @@ import os
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
 
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch("sys.executable", new = '/usr/bin/python2.6')
 class TestServiceCheck(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "YARN/2.1.0.2.0/package"

+ 1 - 0
ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py

@@ -23,6 +23,7 @@ import os
 import  resource_management.libraries.functions
 
 origin_exists = os.path.exists
+@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(resource_management.libraries.functions, "check_process_status", new = MagicMock())
 @patch.object(os.path, "exists", new=MagicMock(
     side_effect=lambda *args: origin_exists(args[0])