ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Newton Alex <na...@pivotal.io>
Subject Stack service plugin unit test question
Date Fri, 22 Jan 2016 19:11:17 GMT
Hello Ambari developers,

Ref: https://issues.apache.org/jira/browse/AMBARI-13439
I need some help with the stack unit test code. I added some unit tests to
HAWQ service that included mocking some functions from within the service
plugin code:

E.g:

---------------
  @patch ('hawqmaster.common.__set_osparams')
  @patch ('hawqmaster.master_helper.__is_active_master')
  @patch ('hawqmaster.master_helper.__is_local_initialized')
  def test_start_default(self, is_local_initialized_mock,
active_master_mock, set_osparams_mock):
...
----------------

But the python mock library is unable to find the HAWQ service plugin files
and fails with the following error msg:

--------

Failed tests:
ERROR: test_configure_default (test_hawqmaster.TestHawqMaster)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
line 1191, in patched
    arg = patching.__enter__()
  File "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
line 1250, in __enter__
    self.target = self.getter()
  File "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
line 1412, in <lambda>
    getter = lambda: _importer(target)
  File "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
line 1096, in _importer
    thing = __import__(import_path)
ImportError: No module named hawqmaster


---------

It seems to work fine if I explicitly export the $PYTHONPATH to the .../
common-services/HAWQ/2.0.0/packages/scripts folder and run the unit test
manually.

I'd greatly appreciate any help or suggestion on how to go about fixing
this problem.

Thanks,
Newton

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message