You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2016/03/02 17:22:28 UTC
ambari git commit: AMBARI-15262. Python UT fail on trunk (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/trunk d6fddcddf -> 464c3ac45
AMBARI-15262. Python UT fail on trunk (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/464c3ac4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/464c3ac4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/464c3ac4
Branch: refs/heads/trunk
Commit: 464c3ac4559b795f846362d0b36c1aacd842ecf2
Parents: d6fddcd
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Mar 2 18:22:24 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Mar 2 18:22:24 2016 +0200
----------------------------------------------------------------------
.../ambari_server/dbConfiguration_linux.py | 3 +-
.../src/test/python/TestAmbariServer.py | 31 +++++---------------
2 files changed, 10 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/464c3ac4/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 1690708..766c089 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -678,7 +678,7 @@ class PGConfig(LinuxDBMSConfig):
def _configure_pg_hba_postgres_user():
postgresString = "all postgres"
pg_hba_conf_file_content_in = sudo.read_file(PGConfig.PG_HBA_CONF_FILE)
- pg_hba_conf_file_content_out = re.sub('all\s*all', postgresString, postgresString)
+ pg_hba_conf_file_content_out = re.sub('all\s*all', postgresString, pg_hba_conf_file_content_in)
sudo.create_file(PGConfig.PG_HBA_CONF_FILE, pg_hba_conf_file_content_out)
sudo.chmod(PGConfig.PG_HBA_CONF_FILE, 0644)
@@ -687,6 +687,7 @@ class PGConfig(LinuxDBMSConfig):
listenAddress = "listen_addresses = '*' #"
postgresql_conf_file_in = sudo.read_file(PGConfig.POSTGRESQL_CONF_FILE)
postgresql_conf_file_out = re.sub('#+listen_addresses.*?(#|$)', listenAddress, postgresql_conf_file_in)
+ sudo.create_file(PGConfig.POSTGRESQL_CONF_FILE, postgresql_conf_file_out)
sudo.chmod(PGConfig.POSTGRESQL_CONF_FILE, 0644)
def _configure_postgres(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/464c3ac4/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 901867c..125868b 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -15,15 +15,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
+import os
+from mock.mock import patch, MagicMock, create_autospec, call
+import sys
+
+with patch.object(os, "geteuid", new=MagicMock(return_value=0)):
+ from resource_management.core import sudo
+ reload(sudo)
+
from stacks.utils.RMFTestCase import *
-import sys
import traceback
-import os
import datetime
import errno
import json
-from mock.mock import patch, MagicMock, create_autospec, call
import operator
from optparse import OptionParser
import platform
@@ -2101,16 +2106,6 @@ class TestAmbariServer(TestCase):
open_Mock.return_value = file
p = get_ambari_properties_mock.return_value
- # Testing call under non-root
- is_root_mock.return_value = False
- try:
- setup_https(args)
- self.fail("Should throw exception")
- except FatalException as fe:
- # Expected
- self.assertTrue("root-level" in fe.reason)
- pass
-
# Testing call under root
is_root_mock.return_value = True
read_ambari_user_method.return_value = "user"
@@ -6813,16 +6808,6 @@ class TestAmbariServer(TestCase):
read_ambari_user_method, exists_mock,
remove_password_file_method, read_master_key_method):
- # Testing call under non-root
- is_root_method.return_value = False
- try:
- setup_master_key(MagicMock())
- self.fail("Should throw exception")
- except FatalException as fe:
- # Expected
- self.assertTrue("root-level" in fe.reason)
- pass
-
# Testing call under root
is_root_method.return_value = True