You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2013/05/21 06:33:31 UTC

svn commit: r1484661 - in /incubator/ambari/trunk: CHANGES.txt ambari-agent/src/test/python/TestActualConfigHandler.py ambari-agent/src/test/python/unitTests.py ambari-server/src/test/python/unitTests.py

Author: smohanty
Date: Tue May 21 04:33:31 2013
New Revision: 1484661

URL: http://svn.apache.org/r1484661
Log:
AMBARI-2173. TEST BROKEN : FAIL: test_upgradeCommand_executeCommand (TestActionQueue.TestActionQueue). (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/src/test/python/TestActualConfigHandler.py
    incubator/ambari/trunk/ambari-agent/src/test/python/unitTests.py
    incubator/ambari/trunk/ambari-server/src/test/python/unitTests.py

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1484661&r1=1484660&r2=1484661&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue May 21 04:33:31 2013
@@ -870,6 +870,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2173. TEST BROKEN : FAIL: test_upgradeCommand_executeCommand
+ (TestActionQueue.TestActionQueue). (smohanty)
+
  AMBARI-2165. Ambari server upgrade fails when upgrading
  second time. (smohanty)
 

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/TestActualConfigHandler.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/TestActualConfigHandler.py?rev=1484661&r1=1484660&r2=1484661&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/TestActualConfigHandler.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/TestActualConfigHandler.py Tue May 21 04:33:31 2013
@@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY 
 See the License for the specific language governing permissions and
 limitations under the License.
 '''
-
+import tempfile
 from unittest import TestCase
 from ambari_agent.AmbariConfig import AmbariConfig
 from ambari_agent.ActualConfigHandler import ActualConfigHandler
@@ -31,17 +31,20 @@ class TestActualConfigHandler(TestCase):
 
   def test_read_write(self):
     config = AmbariConfig().getConfig()
-    config.set('agent', 'prefix', "/tmp")
+    tmpdir = tempfile.gettempdir()
+    config.set('agent', 'prefix', tmpdir)
     handler = ActualConfigHandler(config)
     
     tags = { "global": "version1", "core-site": "version2" }
     handler.write_actual(tags)
     output = handler.read_actual()
     self.assertEquals(tags, output)
+    os.remove(os.path.join(tmpdir, ActualConfigHandler.CONFIG_NAME))
 
   def test_read_write_component(self):
     config = AmbariConfig().getConfig()
-    config.set('agent', 'prefix', "/tmp")
+    tmpdir = tempfile.gettempdir()
+    config.set('agent', 'prefix', tmpdir)
     handler = ActualConfigHandler(config)
 
     tags1 = { "global": "version1", "core-site": "version2" }
@@ -61,4 +64,4 @@ class TestActualConfigHandler(TestCase):
     output4 = handler.read_actual_component('FOO')
     self.assertEquals(tags2, output3)
     self.assertEquals(tags1, output4)
-
+    os.remove(os.path.join(tmpdir, "FOO_" + ActualConfigHandler.CONFIG_NAME))

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/unitTests.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/unitTests.py?rev=1484661&r1=1484660&r2=1484661&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/unitTests.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/unitTests.py Tue May 21 04:33:31 2013
@@ -23,6 +23,7 @@ import doctest
 from os.path import dirname, split, isdir
 import logging.handlers
 import logging
+from random import shuffle
 
 LOG_FILE_NAME='tests.log'
 SELECTED_PREFIX = "_"
@@ -51,6 +52,7 @@ def all_tests_suite():
 
   src_dir = os.getcwd()
   files_list=os.listdir(src_dir)
+  shuffle(files_list)
   tests_list = []
 
   logger.info('------------------------TESTS LIST:-------------------------------------')

Modified: incubator/ambari/trunk/ambari-server/src/test/python/unitTests.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/python/unitTests.py?rev=1484661&r1=1484660&r2=1484661&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/python/unitTests.py (original)
+++ incubator/ambari/trunk/ambari-server/src/test/python/unitTests.py Tue May 21 04:33:31 2013
@@ -20,6 +20,7 @@ import unittest
 import glob
 import os
 import sys
+from random import shuffle
 
 TEST_MASK = 'Test*.py'
 
@@ -31,6 +32,7 @@ def main():
     TEST_MASK = pwd + os.sep + TEST_MASK
 
   tests = glob.glob(TEST_MASK)
+  shuffle(tests)
   modules = [os.path.basename(s)[:-3] for s in tests]
   suites = [unittest.defaultTestLoader.loadTestsFromName(name) for name in
     modules]