HEPCloud / decisionengine_modules

Apache License 2.0
2 stars 19 forks source link

Fix configure_gwms_frontend tests #487

Closed BrunoCoimbra closed 7 months ago

BrunoCoimbra commented 8 months ago

This PR fixes and improves some tests related to the configure_gwms_frontend script.

pep8speaks commented 8 months ago

Hello @BrunoCoimbra! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2024-01-11 16:37:15 UTC
vitodb commented 8 months ago

Unit tests are still failing because /etc/decisionengine is missing. Running unit tests in a container, where the folder /etc/decisionengine exists, it also reports another failure.

Failure log for this other issue is in this collapsible section. ``` =================================== FAILURES =================================== __________________________________ test_main ___________________________________ [gw1] linux -- Python 3.9.16 /usr/bin/python3 self = {} def load_config(self): try: > return json.loads(json.dumps(ValidConfig(self.config_file)["glideinwms"]), object_hook=OrderedDict) self = {} src/decisionengine_modules/glideinwms/DEConfigSource.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/decisionengine/.local/lib/python3.9/site-packages/decisionengine/framework/config/ValidConfig.py:48: in __init__ super().__init__(_config_from_file(filename, jpathdirs)) __class__ = filename = '/etc/decisionengine/decision_engine.jsonnet' jpathdirs = None self = <[AttributeError("'ValidConfig' object has no attribute 'data'") raised in repr()] ValidConfig object at 0x7f4a44bf0a60> /home/decisionengine/.local/lib/python3.9/site-packages/decisionengine/framework/config/ValidConfig.py:26: in _config_from_file if os.path.getsize(config_file) == 0: config_file = '/etc/decisionengine/decision_engine.jsonnet' jpaths = None _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ filename = '/etc/decisionengine/decision_engine.jsonnet' def getsize(filename): """Return the size of a file, reported by os.stat().""" > return os.stat(filename).st_size E FileNotFoundError: [Errno 2] No such file or directory: '/etc/decisionengine/decision_engine.jsonnet' filename = '/etc/decisionengine/decision_engine.jsonnet' /usr/lib64/python3.9/genericpath.py:50: FileNotFoundError The above exception was the direct cause of the following exception: tmp_path = PosixPath('/tmp/pytest-of-decisionengine/pytest-0/popen-gw1/test_main0') def test_main(tmp_path): de_frontend_config = tmp_path / "de_frontend_config" args = SimpleNamespace() args.web_base_dir = "/var/lib/gwms-frontend/web-base" args.update_scripts = False args.de_frontend_config = de_frontend_config > configure_gwms_frontend.main(args) args = namespace(web_base_dir='/var/lib/gwms-frontend/web-base', update_scripts=False, de_frontend_config=PosixPath('/tmp/pytest-of-decisionengine/pytest-0/popen-gw1/test_main0/de_frontend_config')) de_frontend_config = PosixPath('/tmp/pytest-of-decisionengine/pytest-0/popen-gw1/test_main0/de_frontend_config') tmp_path = PosixPath('/tmp/pytest-of-decisionengine/pytest-0/popen-gw1/test_main0') src/decisionengine_modules/glideinwms/tests/test_configure_gwms_frontend.py:29: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src/decisionengine_modules/glideinwms/configure_gwms_frontend.py:25: in main params = UniversalFrontendParams(args.web_base_dir, DEConfigSource()) args = namespace(web_base_dir='/var/lib/gwms-frontend/web-base', update_scripts=False, de_frontend_config=PosixPath('/tmp/pytest-of-decisionengine/pytest-0/popen-gw1/test_main0/de_frontend_config')) src/decisionengine_modules/glideinwms/DEConfigSource.py:21: in __init__ super().__init__() __class__ = config_file = 'decision_engine.jsonnet' self = {} src/decisionengine_modules/glideinwms/ConfigSource.py:14: in __init__ self.update(self.load_config()) __class__ = args = () kwargs = {} self = {} _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = {} def load_config(self): try: return json.loads(json.dumps(ValidConfig(self.config_file)["glideinwms"]), object_hook=OrderedDict) except KeyError as e: raise ConfigError( f"Could not find the required configuration key '{e}' in the Decision Engine configuration ({self.config_file})." ) except RuntimeError as e: raise ConfigError(f"Could not load the Decision Engine configuration ({self.config_file}): {e}") from e except FileNotFoundError as e: > raise FileNotFoundError(f"Could not find the Decision Engine configuration ({self.config_file}).") from e E FileNotFoundError: Could not find the Decision Engine configuration (/etc/decisionengine/decision_engine.jsonnet). self = {} src/decisionengine_modules/glideinwms/DEConfigSource.py:33: FileNotFoundError ```
codecov[bot] commented 8 months ago

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (5a5fb8b) 47.23% compared to head (1428f4e) 47.22%. Report is 8 commits behind head on master.

Files Patch % Lines
...ngine_modules/glideinwms/glide_frontend_element.py 0.00% 10 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #487 +/- ## ========================================== - Coverage 47.23% 47.22% -0.01% ========================================== Files 54 54 Lines 2907 2918 +11 Branches 498 504 +6 ========================================== + Hits 1373 1378 +5 - Misses 1433 1439 +6 Partials 101 101 ``` | [Flag](https://app.codecov.io/gh/HEPCloud/decisionengine_modules/pull/487/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HEPCloud) | Coverage Δ | | |---|---|---| | [python-3.8](https://app.codecov.io/gh/HEPCloud/decisionengine_modules/pull/487/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HEPCloud) | `47.22% <58.33%> (-0.01%)` | :arrow_down: | | [python-3.9](https://app.codecov.io/gh/HEPCloud/decisionengine_modules/pull/487/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HEPCloud) | `47.22% <58.33%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HEPCloud#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

vitodb commented 8 months ago

With last set of updates unit tests are good. On Jenkins there are still tests failing due to the M2Crypto issue in GWMS, but this is happening because the current Jenkins setup uses branch_v3_9 for GWMS instead of master.