You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/02/11 22:04:54 UTC

ambari git commit: AMBARI-9582. Ambari Trunk is broken with multiple test failures (dlysnichenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 4a25974b1 -> 88ae3af0f


AMBARI-9582. Ambari Trunk is broken with multiple test failures (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 88ae3af0fd2156d8798858f0900b9f511159cb6b
Parents: 4a25974
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Wed Feb 11 23:04:03 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Wed Feb 11 23:04:03 2015 +0200

----------------------------------------------------------------------
 .../python/ambari_server/dbConfiguration_linux.py   |  4 ++--
 ambari-server/src/test/python/TestAmbariServer.py   | 16 +++++-----------
 .../test/python/host_scripts/TestAlertDiskSpace.py  |  1 +
 3 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/88ae3af0/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index b2d1372..c92fd9c 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -34,7 +34,7 @@ from ambari_commons.os_utils import copy_files, find_in_path, is_root, remove_fi
 from ambari_server.dbConfiguration import DBMSConfig, USERNAME_PATTERN, SETUP_DB_CONNECT_ATTEMPTS, \
     SETUP_DB_CONNECT_TIMEOUT, STORAGE_TYPE_LOCAL, DEFAULT_USERNAME, DEFAULT_PASSWORD
 from ambari_server.serverConfiguration import get_ambari_properties, get_value_from_properties, configDefaults, \
-    OS_TYPE, AMBARI_PROPERTIES_FILE, RESOURCES_DIR_PROPERTY, \
+    OS_TYPE, OS_FAMILY, AMBARI_PROPERTIES_FILE, RESOURCES_DIR_PROPERTY, \
     JDBC_DATABASE_PROPERTY, JDBC_DATABASE_NAME_PROPERTY, JDBC_POSTGRES_SCHEMA_PROPERTY, \
     JDBC_HOSTNAME_PROPERTY, JDBC_PORT_PROPERTY, \
     JDBC_USER_NAME_PROPERTY, JDBC_PASSWORD_PROPERTY, JDBC_PASSWORD_FILENAME, \
@@ -351,7 +351,7 @@ class PGConfig(LinuxDBMSConfig):
 
     if self.persistence_type == STORAGE_TYPE_LOCAL:
       PGConfig.PG_STATUS_RUNNING = get_postgre_running_status(OS_TYPE)
-      PGConfig.PG_HBA_DIR = get_postgre_hba_dir(OSCheck.get_os_family())
+      PGConfig.PG_HBA_DIR = get_postgre_hba_dir(OS_FAMILY)
 
       PGConfig.PG_HBA_CONF_FILE = os.path.join(PGConfig.PG_HBA_DIR, "pg_hba.conf")
       PGConfig.PG_HBA_CONF_FILE_BACKUP = os.path.join(PGConfig.PG_HBA_DIR, "pg_hba_bak.conf.old")

http://git-wip-us.apache.org/repos/asf/ambari/blob/88ae3af0/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 825991b..5c9d8ff 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -92,6 +92,8 @@ with patch("platform.linux_distribution", return_value = os_distro_value):
 
 CURR_AMBARI_VERSION = "2.0.0"
 
+@patch("ambari_server.dbConfiguration_linux.get_postgre_hba_dir", new = MagicMock(return_value = "/var/lib/pgsql/data"))
+@patch("ambari_server.dbConfiguration_linux.get_postgre_running_status", new = MagicMock(return_value = "running"))
 class TestAmbariServer(TestCase):
   def setUp(self):
     out = StringIO.StringIO()
@@ -2806,9 +2808,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
   @patch("ambari_server.serverSetup.adjust_directory_permissions")
   @patch("ambari_server.serverSetup.read_ambari_user")
   @patch("ambari_server.serverSetup.expand_jce_zip_file")
-  @patch("ambari_server.dbConfiguration_linux.get_postgre_hba_dir")
-  @patch("ambari_server.dbConfiguration_linux.get_postgre_running_status")
-  def test_setup(self, get_postgre_running_status_mock, get_postgre_hba_dir_mock, expand_jce_zip_file_mock,
+  def test_setup(self, expand_jce_zip_file_mock,
                  read_ambari_user_mock, adjust_dirs_mock, extract_views_mock, proceedJDBCProperties_mock, is_root_mock,
                  disable_security_enhancements_mock, check_jdbc_drivers_mock, check_ambari_user_mock,
                  download_jdk_mock, configure_os_settings_mock, get_ambari_properties_mock,
@@ -3238,10 +3238,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
   @patch("getpass.getuser")
   @patch("os.chdir")
   @patch.object(ResourceFilesKeeper, "perform_housekeeping")
-  @patch("ambari_server.dbConfiguration_linux.get_postgre_hba_dir")
-  @patch("ambari_server.dbConfiguration_linux.get_postgre_running_status")
-  def test_start(self, get_postgre_running_status_mock, get_postgre_hba_dir_mock,
-                 perform_housekeeping_mock, chdir_mock, getuser_mock, find_jdbc_driver_mock,
+  def test_start(self, perform_housekeeping_mock, chdir_mock, getuser_mock, find_jdbc_driver_mock,
                  is_root_mock, is_root_2_mock, read_ambari_user_mock,
                  check_postgre_up_mock, print_info_msg_mock, print_warning_msg_mock,
                  find_jdk_mock, check_database_name_property_mock, search_file_mock,
@@ -4116,10 +4113,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
   @patch("ambari_server.serverUpgrade.get_ambari_properties")
   @patch("ambari_server.serverUpgrade.upgrade_local_repo")
   @patch("ambari_server.serverUpgrade.move_user_custom_actions")
-  @patch("ambari_server.dbConfiguration_linux.get_postgre_hba_dir")
-  @patch("ambari_server.dbConfiguration_linux.get_postgre_running_status")
-  def test_upgrade(self, get_postgre_running_status_mock, get_postgre_hba_dir_mock,
-                   move_user_custom_actions, upgrade_local_repo_mock,
+  def test_upgrade(self, move_user_custom_actions, upgrade_local_repo_mock,
                    get_ambari_properties_mock, get_ambari_properties_2_mock, get_ambari_properties_3_mock,
                    is_root_mock, get_ambari_version_mock, get_ambari_version_2_mock,
                    parse_properties_file_mock,

http://git-wip-us.apache.org/repos/asf/ambari/blob/88ae3af0/ambari-server/src/test/python/host_scripts/TestAlertDiskSpace.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/host_scripts/TestAlertDiskSpace.py b/ambari-server/src/test/python/host_scripts/TestAlertDiskSpace.py
index 45aa15a..4a265e1 100644
--- a/ambari-server/src/test/python/host_scripts/TestAlertDiskSpace.py
+++ b/ambari-server/src/test/python/host_scripts/TestAlertDiskSpace.py
@@ -28,6 +28,7 @@ from stacks.utils.RMFTestCase import *
 class TestAlertDiskSpace(RMFTestCase):
 
   @patch('alert_disk_space._get_disk_usage')
+  @patch.object(OSCheck, "get_os_family", new = MagicMock(return_value = 'redhat'))
   def test_linux_flow(self, disk_usage_mock):
     # / OK, /usr/hdp OK
     disk_usage_mock.return_value = \