Repository: ambari
Updated Branches:
  refs/heads/trunk 5291228c3 -> 1bf667ead


AMBARI-15300. Ability to customize Server LOG + PID dirs (aonishuk)


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

Branch: refs/heads/trunk
Commit: 1bf667ead7e164fa16896a8bba9ba91d802aab14
Parents: 5291228
Author: Andrew Onishuk <aonis...@hortonworks.com>
Authored: Fri Mar 18 00:40:49 2016 +0200
Committer: Andrew Onishuk <aonis...@hortonworks.com>
Committed: Fri Mar 18 00:41:10 2016 +0200

----------------------------------------------------------------------
 ambari-server/src/test/python/TestServerUpgrade.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1bf667ea/ambari-server/src/test/python/TestServerUpgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestServerUpgrade.py 
b/ambari-server/src/test/python/TestServerUpgrade.py
index 05a7c6b..04ec337 100644
--- a/ambari-server/src/test/python/TestServerUpgrade.py
+++ b/ambari-server/src/test/python/TestServerUpgrade.py
@@ -23,8 +23,20 @@ import sys
 from ambari_commons.exceptions import FatalException
 from unittest import TestCase
 from mock.mock import patch, MagicMock
-from ambari_server.serverUpgrade import set_current, SetCurrentVersionOptions, 
upgrade_stack
-import ambari_server
+from ambari_commons import os_utils
+
+import shutil
+project_dir = 
os.path.join(os.path.abspath(os.path.dirname(__file__)),os.path.normpath("../../../../"))
+shutil.copyfile(project_dir+"/ambari-server/conf/unix/ambari.properties", 
"/tmp/ambari.properties")
+
+_search_file = os_utils.search_file
+os_utils.search_file = MagicMock(return_value="/tmp/ambari.properties")
+
+with patch.object(os_utils, "parse_log4j_file", 
return_value={'ambari.log.dir': '/var/log/ambari-server'}):
+  from ambari_server.serverUpgrade import set_current, 
SetCurrentVersionOptions, upgrade_stack
+  import ambari_server
+
+os_utils.search_file = _search_file
 
 
 class TestServerUpgrade(TestCase):

Reply via email to