[
https://issues.apache.org/jira/browse/AMBARI-23264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16403496#comment-16403496
]
Hudson commented on AMBARI-23264:
---------------------------------
FAILURE: Integrated in Jenkins build Ambari-trunk-Commit #8869 (See
[https://builds.apache.org/job/Ambari-trunk-Commit/8869/])
[AMBARI-23264] Fix TestMySqlServer error while executing unit tests on (rlevas:
[https://gitbox.apache.org/repos/asf?p=ambari.git&a=commit&h=10a1e8b692ecd3de8b79bda1abc6fd6b0a8547ce])
* (edit) ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py
> Fix TestMySqlServer error while executing unit tests on MacOS/Darwin
> --------------------------------------------------------------------
>
> Key: AMBARI-23264
> URL: https://issues.apache.org/jira/browse/AMBARI-23264
> Project: Ambari
> Issue Type: Task
> Components: ambari-server
> Affects Versions: 2.7.0
> Reporter: Robert Levas
> Assignee: Robert Levas
> Priority: Major
> Labels: pull-request-available, unit-test
> Fix For: 2.7.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Fix TestMySqlServer error while executing unit tests on MacOS/Darwin.
>
> {noformat}
> ERROR: test_configure_secured (test_mysql_server.TestMySqlServer)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File
> "/Users/rlevas/github/ambari/ambari-common/src/test/python/mock/mock.py",
> line 1199, in patched
> return func(*args, **keywargs)
> File
> "/Users/rlevas/github/ambari/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py",
> line 84, in test_configure_secured
> self.assert_configure_secured()
> File
> "/Users/rlevas/github/ambari/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py",
> line 168, in assert_configure_secured
> mode = 0755,
> File
> "/Users/rlevas/github/ambari/ambari-server/src/test/python/stacks/utils/RMFTestCase.py",
> line 345, in assertResourceCalled
> self.assertEquals(kwargs, resource.arguments)
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py",
> line 515, in assertEqual
> assertion_func(first, second, msg=msg)
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py",
> line 831, in assertDictEqual
> if d1 != d2:
> File
> "/Users/rlevas/github/ambari/ambari-common/src/main/python/resource_management/core/source.py",
> line 59, in __eq__
> and ((self.name.startswith(os.sep) and self.name == other.name) or
> self.get_content() == other.get_content()))
> File
> "/Users/rlevas/github/ambari/ambari-common/src/main/python/resource_management/core/source.py",
> line 78, in get_content
> return self.read_file(path)
> File
> "/Users/rlevas/github/ambari/ambari-common/src/main/python/ambari_commons/os_family_impl.py",
> line 84, in thunk
> fn_id = fn_id_base + "." + OSCheck.get_os_family()
> File
> "/Users/rlevas/github/ambari/ambari-common/src/main/python/ambari_commons/os_check.py",
> line 277, in get_os_family
> os_family = OSCheck.get_os_type()
> File
> "/Users/rlevas/github/ambari/ambari-common/src/main/python/ambari_commons/os_check.py",
> line 242, in get_os_type
> return OSCheck.get_alias(OSCheck._get_os_type(), OSCheck._get_os_version())[0]
> File
> "/Users/rlevas/github/ambari/ambari-common/src/main/python/ambari_commons/os_check.py",
> line 248, in _get_os_type
> dist = OSCheck.os_distribution()
> File
> "/Users/rlevas/github/ambari/ambari-common/src/main/python/ambari_commons/os_check.py",
> line 202, in os_distribution
> distribution = platform.linux_distribution()
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.py",
> line 329, in linux_distribution
> return _dist_try_harder(distname,version,id)
> File
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/platform.py",
> line 205, in _dist_try_harder
> info = open('/var/adm/inst-log/info').readlines()
> IOError: [Errno 2] No such file or directory:
> '/var/adm/inst-log/info'{noformat}
>
> *Cause*
> This is caused by the following mock
> {code:java}
> @patch("os.path.exists", MagicMock(return_value=True))
> {code}
> Which allow a later call on the Python 2.7 library to return {{True}},
> causing {{/var/adm/inst-log/info}} to appear to exist and then be read. Since
> {{/var/adm/inst-log/info}} does not exist, this fails, as seen above.
> *Solution*
> Mock the OsCheck function to avoid this.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)