-
Notifications
You must be signed in to change notification settings - Fork 82
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
Bug in expiration date for end of month - it updates to previous month #1592
Comments
@TejasRGitHub I think we can use your input here. Why is there a |
Hi @dlpzx , Thanks for spotting this issue. The For example, But with the bug you just raised I got to see how this is problematic. Proposed change in share expiration:In this scenario ( represented in the bug filed above ) , if a user requests a share at the end of the month, then the user should be granted expiration till the end of the next month. Calculation can be modified to : if currentDate > Total Days in Month / 2:
monthlyCalculatedDate = currentDate + relativedelta(months=expirationPeriod)
else:
monthlyCalculatedDate = currentDate + relativedelta(months=expirationPeriod - 1) |
I am implementing this fix; with the proposal the behavior is that if we are in the first half of the month then we extend until end of month and if we are in the second half of the month we extend until end of next month? |
Yes. you are right |
@dlpzx , also for this one, -xxxxxx---- if dataset.enableExpiration and share.requestedExpiryDate and share.requestedExpiryDate < datetime.today():
raise Exception(
'Cannot approve share extension since its it past the requested expiration date. Please reject this share and submit a new share request'
) -xxxxx---- Just wanted to clarify that no changes needed in this . In my previous message I erred and also proposed changes in this but it it not needed. |
Describe the bug
When running the integration tests (current ones) the
tests/modules/s3_datasets_shares/test_share.py::test_submit_share_extension_request_with_auto_approval
test fails: https://github.com/data-dot-all/dataall/actions/runs/11102824595/job/30843468276?pr=1573The issue seems to be in the expiration date set to test the share expiration dates on share submission.
Checking the logs of getShareObject after the request is submitted:
'expiryDate': '2024-09-30 00:00:00', 'requestedExpiryDate': '2024-09-30 00:00:00',
---> which means thatshare.requestedExpiryDate < datetime.today()
is True so the test falls into this block from the share_object_service:The dataset expiration settings are defined in the fixture
dataset_with_expiration_with_autoapproval
The issue might be in
backend/dataall/modules/shares_base/services/share_object_service.py:327
where we calculate the expiration date. We should be trying to set it to October 31 not to September 30.Today is Sept 30. the line to calculate the end of month date is wrong as the delta is 0 so
monthlyCalculatedDate = 30/09/2024 + relativedelta(months=1 - 1) = 30/09/2024
How to Reproduce
Run tests as it is done automatically in our PRs. One example of the failure is in this PR: https://github.com/data-dot-all/dataall/actions/runs/11102824595/job/30843468276?pr=1573
Expected behavior
No response
Your project
No response
Screenshots
No response
OS
na
Python version
na
AWS data.all version
2.6.0
Additional context
No response
The text was updated successfully, but these errors were encountered: