Selaa lähdekoodia

AMBARI-1715. Ambari Agent Unit Test Failure: TestFileUtil.py. (smohanty)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1461323 13f79535-47bb-0310-9956-ffa450edef68
Sumit Mohanty 12 vuotta sitten
vanhempi
commit
790c31164c
2 muutettua tiedostoa jossa 8 lisäystä ja 1 poistoa
  1. 2 0
      CHANGES.txt
  2. 6 1
      ambari-agent/src/test/python/TestFileUtil.py

+ 2 - 0
CHANGES.txt

@@ -527,6 +527,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1715. Ambari Agent Unit Test Failure: TestFileUtil.py. (smohanty)
+
  AMBARI-1533. Add Nagios check for ambari-agent process for each host in 
  the cluster. (smohanty)
 

+ 6 - 1
ambari-agent/src/test/python/TestFileUtil.py

@@ -21,9 +21,14 @@ limitations under the License.
 from unittest import TestCase
 from ambari_agent.FileUtil import writeFile, createStructure, deleteStructure
 import os, errno
+import tempfile
+from ambari_agent  import AmbariConfig
 
 class TestFileUtil(TestCase):
+
   def test_createStructure(self):
+    tmpdir = tempfile.gettempdir()
+    AmbariConfig.config.set('agent', 'prefix', tmpdir)
     action = { 'clusterId' : 'abc', 'role' : 'hdfs', 'workDirComponent' : 'abc-hdfs' }
     result = {}
     result = createStructure(action, result)
@@ -35,7 +40,7 @@ class TestFileUtil(TestCase):
       "owner"      : os.getuid(),
       "group"      : os.getgid() ,
       "permission" : 0700,
-      "path"       : "/tmp/ambari_file_test/_file_write_test",
+      "path"       : os.path.join(tmpdir, "ambari_file_test/_file_write_test"),
       "umask"      : 022
     }
     action = {