ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-10398. Add necessary mocks for unit tests to pass on any OS (aonishuk)
Date Fri, 10 Apr 2015 09:26:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk defac75b0 -> 9d9dc00bb


AMBARI-10398. Add necessary mocks for unit tests to pass on any OS (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9d9dc00b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9d9dc00b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9d9dc00b

Branch: refs/heads/trunk
Commit: 9d9dc00bba503adf21f325fbe123d71327f293e1
Parents: defac75
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Apr 10 12:26:23 2015 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Apr 10 12:26:23 2015 +0300

----------------------------------------------------------------------
 .../TestMonitorWebserverResource.py              | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9d9dc00b/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
b/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
index f149a3c..5cd55a8 100644
--- a/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
@@ -45,10 +45,18 @@ class TestMonitorWebserverResource(TestCase):
                          ', Execute[\'(\'/etc/init.d/httpd\', \'start\')\']]'
     self.assertEqual(str(defined_resources), expected_resources)
 
+  @patch.object(OSCheck, "is_suse_family")
+  @patch.object(OSCheck, "is_ubuntu_family")
+  @patch.object(OSCheck, "is_redhat_family")
   @patch.object(System, "os_family", new='suse')
-  def test_setup_suse(self):
+  def test_setup_suse(self, is_redhat_family, is_ubuntu_family, is_suse_family):
+    is_redhat_family.return_value = False
+    is_ubuntu_family.return_value = False
+    is_suse_family.return_value = True
+    
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("start")).action_start()
+
     defined_resources = env.resource_list
     expected_resources = '[MonitorWebserver[\'start\'], Execute[\'grep -E \'KeepAlive (On|Off)\'
' \
                          '/etc/apache2/httpd.conf && ambari-sudo.sh [RMF_ENV_PLACEHOLDER]
-H -E sed -i ' \
@@ -71,8 +79,15 @@ class TestMonitorWebserverResource(TestCase):
     expected_resources = '[MonitorWebserver[\'stop\'], Execute[\'(\'/etc/init.d/httpd\',
\'stop\')\']]'
     self.assertEqual(str(defined_resources), expected_resources)
 
+  @patch.object(OSCheck, "is_suse_family")
+  @patch.object(OSCheck, "is_ubuntu_family")
+  @patch.object(OSCheck, "is_redhat_family")
   @patch.object(System, "os_family", new='suse')
-  def test_stop_suse(self):
+  def test_stop_suse(self, is_redhat_family, is_ubuntu_family, is_suse_family):
+    is_redhat_family.return_value = False
+    is_ubuntu_family.return_value = False
+    is_suse_family.return_value = True
+
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("stop")).action_stop()
     defined_resources = env.resource_list


Mime
View raw message