ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject git commit: AMBARI-6064. Server unittests should remove temporary files (aonishuk)
Date Fri, 13 Jun 2014 13:21:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk cc603dca2 -> b33ec74ed


AMBARI-6064. Server unittests should remove temporary files (aonishuk)


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

Branch: refs/heads/trunk
Commit: b33ec74ed9bcb10b290657f1eb27f7ba493ec2a6
Parents: cc603dc
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Jun 13 16:21:00 2014 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Jun 13 16:21:00 2014 +0300

----------------------------------------------------------------------
 ambari-server/src/test/python/TestAmbariServer.py | 7 +++++++
 ambari-server/src/test/python/TestOSCheck.py      | 4 ++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b33ec74e/ambari-server/src/test/python/TestAmbariServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py
index f169468..ea3a1f5 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -24,6 +24,7 @@ from mock.mock import patch
 from mock.mock import MagicMock
 from mock.mock import create_autospec
 import os, errno, tempfile
+import glob
 import signal
 import stat
 import datetime
@@ -3567,6 +3568,8 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
     self.assertEquals(result, 0)
 
     os.unlink(fn2)
+    os.unlink(ambari_server.AMBARI_PROPERTIES_RPMSAVE_FILE
+              + '.' + timestamp.strftime('%Y%m%d%H%M%S'))
 
     #if ambari.properties file is absent then "ambari-server upgrade" should
     # fail
@@ -3575,6 +3578,8 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
 
     result = ambari_server.update_ambari_properties()
     self.assertNotEquals(result, 0)
+    os.unlink(os.path.join(tempfile.gettempdir(),'password.dat'))
+    os.unlink(fn)
 
   @patch.object(ambari_server.Properties, '__init__')
   @patch.object(ambari_server, 'search_file')
@@ -3628,6 +3633,8 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
     self.assertEqual(value, "root")
 
     os.unlink(fn2)
+    prev_conf_file = glob.glob(ambari_server.AMBARI_PROPERTIES_RPMSAVE_FILE+'*')
+    os.unlink(prev_conf_file[0])
 
 
   @patch.object(ambari_server, 'verify_setup_allowed')

http://git-wip-us.apache.org/repos/asf/ambari/blob/b33ec74e/ambari-server/src/test/python/TestOSCheck.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestOSCheck.py b/ambari-server/src/test/python/TestOSCheck.py
index 7a29ec3..2bbc07b 100644
--- a/ambari-server/src/test/python/TestOSCheck.py
+++ b/ambari-server/src/test/python/TestOSCheck.py
@@ -21,6 +21,7 @@ limitations under the License.
 import platform
 import datetime
 import os
+import glob
 import errno
 import tempfile
 import sys
@@ -211,6 +212,9 @@ class TestOSCheck(TestCase):
     # Command should not fail if *.rpmsave file is missing
     result = ambari_server.update_ambari_properties()
     self.assertEquals(result, 0)
+    os.unlink(fn2)
+    prev_conf_file = glob.glob(ambari_server.AMBARI_PROPERTIES_RPMSAVE_FILE+'*')
+    os.unlink(prev_conf_file[0])
 
   @patch("platform.linux_distribution")
   def test_os_type_check(self, mock_linux_distribution):


Mime
View raw message