Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create unit tests for MSOutput #9789

Open
todor-ivanov opened this issue Jul 2, 2020 · 0 comments
Open

Create unit tests for MSOutput #9789

todor-ivanov opened this issue Jul 2, 2020 · 0 comments

Comments

@todor-ivanov
Copy link
Contributor

Impact of the new feature
MicroServices

Is your feature request related to a problem? Please describe.
This is a followup from this PR #9772 (review)
We need to create unit tests for MSOutput, but because of MongoDB dependencies this task turnes into a non trivial one. For testing any of the methods inside the MSOutput Class, one needs an instance of it, but then we need the MongoDb to be up and running in the container for the unit tests - which is not the case for the moment. So far the whole thing is breaking with [1]. And even more,. We also need to explore how would this behave when the Unit test is about to be run by Jenkins.

[1]

[dmwm@a4e07b4a650f Unified_t]$ nosetests MSOutput_t.py
/home/dmwm/unittestdeploy/wmagent/1.3.6.pre4/sw/slc7_amd64_gcc630/external/py2-cryptography/2.4.2-comp2/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py:163: CryptographyDeprecationWarning: OpenSSL version 1.0.1 is no longer supported by the OpenSSL project, please upgrade. A future version of cryptography will drop support for it.
  utils.CryptographyDeprecationWarning
E
======================================================================
ERROR: Test the getCampaignConfig method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dmwm/wmcore_unittest/WMCore/test/python/WMCore_t/MicroService_t/Unified_t/MSOutput_t.py", line 47, in setUp
    self.ms = MSOutput(self.msConfig, 'MSOutputConsumer')
  File "/home/dmwm/wmcore_unittest/WMCore/src/python/WMCore/MicroService/Unified/MSOutput.py", line 134, in __init__
    self.msOutDB = MongoDB(**msOutDBConfig).msOutDB
  File "/home/dmwm/wmcore_unittest/WMCore/src/python/WMCore/Database/MongoDB.py", line 47, in __init__
    raise ex
ServerSelectionTimeoutError: localhost:8230: [Errno 111] Connection refused
-------------------- >> begin captured logging << --------------------
root: DEBUG: Reading mocked SiteDB data from the file /home/dmwm/wmcore_unittest/WMCore/test/python/../data/Mock/SiteDBMockData.json 
root: INFO: Configuration including default values:
...

root: DEBUG: Initializing CRIC with url: https://cms-cric.cern.ch/
root: ERROR: Could not connect to MongoDB server: mongodb://localhost
localhost:8230: [Errno 111] Connection refusedGiving up Now.
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 1 test in 30.127s

FAILED (errors=1)

Describe the solution you'd like
Create unit tests for MSOutput.

Describe alternatives you've considered
No alternatives

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants