فهرست منبع

AMBARI-10083 - Ambari Agent Alerts Prevents Binding to the Ping Port Listener On Startup (part 2) (jonathanhurley)

Jonathan Hurley 10 سال پیش
والد
کامیت
966d39333e

+ 4 - 4
ambari-agent/src/test/python/ambari_agent/TestController.py

@@ -339,12 +339,12 @@ class TestController(unittest.TestCase):
     self.assertTrue(sendRequestMock.call_count > 5)
     self.assertTrue(sendRequestMock.call_count > 5)
 
 
 
 
-  @patch("os._exit")
-  def test_restartAgent(self, os_exit_mock):
+  @patch("sys.exit")
+  def test_restartAgent(self, sys_exit_mock):
 
 
     self.controller.restartAgent()
     self.controller.restartAgent()
-    self.assertTrue(os_exit_mock.called)
-    self.assertTrue(os_exit_mock.call_args[0][0] == AGENT_AUTO_RESTART_EXIT_CODE)
+    self.assertTrue(sys_exit_mock.called)
+    self.assertTrue(sys_exit_mock.call_args[0][0] == AGENT_AUTO_RESTART_EXIT_CODE)
 
 
 
 
   @patch("urllib2.Request")
   @patch("urllib2.Request")

+ 3 - 3
ambari-agent/src/test/python/ambari_agent/TestProcessHelper.py

@@ -47,13 +47,13 @@ class TestProcessHelper(unittest.TestCase):
     self.assertFalse(os.path.exists(tf3.name))
     self.assertFalse(os.path.exists(tf3.name))
 
 
 
 
-  @patch("os._exit")
+  @patch("sys.exit")
   @patch.object(ProcessHelper, "_clean")
   @patch.object(ProcessHelper, "_clean")
-  def test_stopAgent(self, _clean_mock, exitMock):
+  def test_stopAgent(self, _clean_mock, sys_exit_mock):
 
 
     ProcessHelper.stopAgent()
     ProcessHelper.stopAgent()
     self.assertTrue(_clean_mock.called)
     self.assertTrue(_clean_mock.called)
-    self.assertTrue(exitMock.called)
+    self.assertTrue(sys_exit_mock.called)
 
 
 
 
   @patch("os.execvp")
   @patch("os.execvp")