-
Notifications
You must be signed in to change notification settings - Fork 192
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
🐛 FIX: Add broker_*
parameters to default test config.
#4831
🐛 FIX: Add broker_*
parameters to default test config.
#4831
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4831 +/- ##
========================================
Coverage 79.52% 79.52%
========================================
Files 519 519
Lines 37087 37087
========================================
Hits 29490 29490
Misses 7597 7597
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot for the fix @greschd
just one comment
aiida/manage/tests/__init__.py
Outdated
'repository_uri': f'file://{self.repo}', | ||
} | ||
for key in ['broker_protocol', 'broker_username', 'broker_password', 'broker_host', 'broker_port']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess currently these are the only ones regarded as optional, but one could also imagine e.g. the database_port
having a default value in the future.
Why not use this loop for all keys of the dictionary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to note,
for the broker defaults, they currently come from BROKER_DEFAULTS
:
aiida-core/aiida/manage/external/rmq.py
Line 41 in 75310e0
BROKER_DEFAULTS = AttributeDict({ |
But really I think all the defaults should derive from the schema defaults (in https://github.com/aiidateam/aiida-core/blob/develop/aiida/manage/configuration/schema/config-v5.schema.json), as happens for the options, i.e. the schema would be the "source of truth" for all defaults.
I just didn't have time to do this with the configuration refactor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use this loop for all keys of the dictionary?
If null
is invalid for all keys I agree that makes more sense.
Maybe getting the defaults for both the broker and the other options from the schema can be a separate PR?
This is a bug, right? This can be fixed in another PR if you prefer but I think this should be addressed. |
I'm sure we discussed this in #4712 and agreed not to validate (I can't find exactly where now though) Note whenever you alter individual configuration options or when you use |
I'm not so up-to-date on the configuration code, so yeah it would probably be easier for someone else to address this in a separate PR. |
c82b591
to
4961d93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @greschd
Aah, seems some parts of the test suite require those keys to be there (even if they're Maybe the simplest way to fix this then is to add the |
4961d93
to
0ab25f1
Compare
Alright, next try: Now I simply added the configuration values to Initially I had them extracted programmatically from the config schema, but then I noticed not all keys are the same in |
In the `TestManager`, set the `broker_*` parameters by adding them to the `_DEFAULT_PROFILE_INFO`. The default values were copied from the config schema. They could be extracted directly, but since some keys (e.g. `AIIDADB_*`) are named differently in the `profile_info` compared to the config schema, this may be unreliable. Previously, these were set to `None` by default, which caused the config validation to fail because only string values are allowed.
0ab25f1
to
b1c05b7
Compare
broker_*
parameters from test config.broker_*
parameters to default test config.
cheers
The key mapping comes from:
We also discussed removing this mapping in #4712 (but as with #4831 (comment), that PR was already big enough, so didn't want to add any more complexity) |
Thanks @chrisjsewell - do you think it'd be better in this PR to hard-code things (and clean up together with further config refactoring), or go through the mapping and get these values from the schema? I think, since there's a test checking that the test config validates, we should at least notice when things are broken now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @greschd - sorry for the back & forth
No problem, and thanks for the review @ltalirz! |
) In the `TestManager`, set the `broker_*` parameters by adding them to the `_DEFAULT_PROFILE_INFO`. The default values were copied from the config schema. They could be extracted directly, but since some keys (e.g. `AIIDADB_*`) are named differently in the `profile_info` compared to the config schema, this may be unreliable. Previously, these were set to `None` by default, which caused the config validation to fail because only string values are allowed.
Thanks for the fix! The original bug appears to break plugin tests that involve running processes with the daemon. |
yes there will be a release |
Thanks for fixing this folks. Any ETA on the release? |
I think it's already released in 1.6.1. |
Yep 👍 |
Fixes #4830.
In the
TestProfileManager
, set thebroker_*
parameters only if they are explicitly present in theprofile_info
.Previously, these were set to
None
by default, which caused the config validation to fail because only string values are allowed.I think the "root cause" why this wasn't caught is because there is validation in the
Config
constructor, but not theProfile
constructor. This is the code constructing the profile:aiida-core/aiida/manage/tests/__init__.py
Lines 333 to 336 in 75310e0
Another option for fixing this issue would be explicitly setting the
broker_*
parameters in_DEFAULT_PROFILE_INFO
:aiida-core/aiida/manage/tests/__init__.py
Lines 28 to 42 in 75310e0