incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r1492508 - /incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py
Date Thu, 13 Jun 2013 00:10:27 GMT
Author: mahadev
Date: Thu Jun 13 00:10:27 2013
New Revision: 1492508

URL: http://svn.apache.org/r1492508
Log:
AMBARI-2369. Ambari setup stops on Postgresql start on SLES11. (Siddharth Wagle via mahadev)

Modified:
    incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py

Modified: incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py?rev=1492508&r1=1492507&r2=1492508&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py (original)
+++ incubator/ambari/trunk/ambari-server/src/test/python/TestAmbaryServer.py Thu Jun 13 00:10:27
2013
@@ -709,20 +709,26 @@ class TestAmbariServer(TestCase):
     self.assertEqual(None, result)
 
 
-
-  @patch.object(ambari_server, "run_os_command")
+  @patch("subprocess.Popen")
+  @patch.object(ambari_server, 'run_os_command')
   @patch.object(ambari_server, "get_postgre_status")
-  def test_check_postgre_up(self, get_postgre_status_mock, run_os_command_mock):
+  def test_check_postgre_up(self, get_postgre_status_mock,
+                            run_os_command_method, popen_mock):
 
     out = StringIO.StringIO()
     sys.stdout = out
 
+    p = MagicMock()
+    p.poll.return_value = 0
+    popen_mock.return_value = p
     get_postgre_status_mock.return_value = ambari_server.PG_STATUS_RUNNING
+    run_os_command_method.return_value = (0, None, None)
+
     rcode = ambari_server.check_postgre_up()
     self.assertEqual(0, rcode)
 
-    run_os_command_mock.return_value = (4, None, None)
     get_postgre_status_mock.return_value = None
+    p.poll.return_value = 4
     rcode = ambari_server.check_postgre_up()
     self.assertEqual(4, rcode)
 



Mime
View raw message