-
Notifications
You must be signed in to change notification settings - Fork 27
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
✅ Extends test_EC2_INSTANCES_ALLOWED_TYPES_empty_not_allowed #6705
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6705 +/- ##
===========================================
- Coverage 87.75% 66.85% -20.91%
===========================================
Files 1569 651 -918
Lines 63153 33131 -30022
Branches 2116 265 -1851
===========================================
- Hits 55423 22150 -33273
- Misses 7405 10920 +3515
+ Partials 325 61 -264
Continue to review full report in Codecov by Sentry.
|
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 there's gonna be a different PR with the fix on the pydantic-v2-migration branch, right?
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
8a96f7b
to
c955230
Compare
yes, this is a guideline so that I can fix it in the pydantic-v2-migration branch. |
b1dc11b
to
6b4d346
Compare
Quality Gate passedIssues Measures |
What do these changes do?
In PR #6701, the test
test_EC2_INSTANCES_ALLOWED_TYPES_empty_not_allowed
fails with the new Pydantic version, but it unexpectedly passes with the previous version. This PR modifies the test to highlight a bug in ourBaseCustomsSettings
logic when using Pydantic v1.The bug originates from a workaround initially applied by @YuryHrytsuk on the refactoring of docker-compose environments (this is also related to this change ITISFoundation/osparc-ops-environments#866), which involved using an empty dictionary
{}
as an environment variable value to simulate an "unset" state. This workaround impacts fields set withauto-default-factory=True
, where empty dicts{}
mark fields asUNSET
.In particular, this test case focuses on the field
ApplicationSettings.AUTOSCALING_EC2_INSTANCES: EC2InstancesSettings | None
, which is a nullable field with an auto-default factory. Thetest_EC2_INSTANCES_ALLOWED_TYPES_empty_not_allowed
test expects the auto-default factory to returnNone
. Instead, it raises aValidationError
becauseAUTOSCALING_EC2_INSTANCES={}
is misinterpreted as a valid assignment instead of as an unset state.This PR enhances
test_EC2_INSTANCES_ALLOWED_TYPES_empty_not_allowed
to establish a foundation for the migration to Pydantic v2, as outlined in PR #6701. In this migration, we will address the issue by enforcing thatAUTOSCALING_EC2_INSTANCES={}
is treated as an explicit assignment rather than an "unset" sentinel.Related issue/s
How to test
Dev-ops