-
Notifications
You must be signed in to change notification settings - Fork 84
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
[RHELC-1375] Port RestorableFile to BackupController #1045
Conversation
TODO
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1045 +/- ##
==========================================
+ Coverage 94.33% 94.42% +0.09%
==========================================
Files 47 48 +1
Lines 4552 4523 -29
Branches 811 805 -6
==========================================
- Hits 4294 4271 -23
+ Misses 182 178 -4
+ Partials 76 74 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
First part of the port for the remaining items for the BackupController. Changes included in this work are: 1. Remove the old RestorableFile class in order to use the NewRestorableFile 2. Rename the NewRestorableFile back to RestorableFile 3. Fix a bug where test pollution was happening in the BackupController global object Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
f582e45
to
0a57952
Compare
Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
8583bd1
to
3e70eba
Compare
|
||
from convert2rhel import exceptions | ||
from convert2rhel.backup import RestorableChange | ||
from convert2rhel.utils import BACKUP_DIR |
Check notice
Code scanning / CodeQL
Cyclic import Note
convert2rhel.utils
@@ -21,7 +21,8 @@ | |||
import os | |||
import re | |||
|
|||
from convert2rhel import backup, pkgmanager, utils | |||
from convert2rhel import pkgmanager, utils |
Check notice
Code scanning / CodeQL
Cyclic import Note
convert2rhel.utils
@@ -21,7 +21,8 @@ | |||
import os | |||
import re | |||
|
|||
from convert2rhel import backup, pkgmanager, utils | |||
from convert2rhel import pkgmanager, utils | |||
from convert2rhel.backup.files import RestorableFile |
Check notice
Code scanning / CodeQL
Cyclic import Note
convert2rhel.backup.files
convert2rhel/unit_tests/actions/pre_ponr_changes/backup_system_test.py
Fixed
Show resolved
Hide resolved
Refactoring the way we organize the files backup related code. Currently, we just throw everything inside the backup.py module and call the classes/functions from there. With this commit, we refactor have it's own module inside the backup folder. The idea is to bring all of the others backup codes to it's own module as well, and leave the backup/__init__.py to be a base module that will have only base code for the other modules. Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
3e70eba
to
bfba68b
Compare
In this PR, I'm trying to refactor the way we organize the backup code related to files and the other modules. The idea is that in the next PRs we take the code from the backup/init.py and split them into their own modules and keep organizing the backup there. If people think that the complexity increases, we can rollback to the original and move from there... But I strongly think that it will help to organize the code and give the idea that the backup is an API to be used across the rest of the project. |
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.
Didn't look over the unit tests yet
convert2rhel/backup/files.py
Outdated
# Do not call 'critical' which would halt the program. We are in | ||
# a rollback phase now and we want to rollback as much as possible. | ||
loggerinst.warning("Error(%s): %s" % (err.errno, err.strerror)) | ||
return |
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.
Same here, do we want to use critical_no_exit()
?
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.
Maybe it would help if we made the choices critical
and critical_exit
? The one that exits is the one with the side effect (and a significant side effect at that), which argues that it should be the one with the more detailed name. It would also make the code more clear to someone just browsing it.
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.
Agreed @jochapma, we made it this way for making it easier to migrate later. Easier to add critical_no_exit()
and call it than to refactor the whole codebase. Technical debt in the making but something we had to do last year
convert2rhel/unit_tests/actions/pre_ponr_changes/backup_system_test.py
Fixed
Show resolved
Hide resolved
Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
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.
LGTM
/packit test --labels tier0 |
I like the way how you split the backup and organized it into the modules. I agree that it help with organizing it, having it in one file was a bit messy - especially after adding more restorable things. |
This commit prevents the RestorableFile being enabled if the target filepath is not a file. It also removes duplicated tests cases where the test was the same, but using the backup controller instead. It is not required to use backup controller instance for those type of tests, since we want to test the RestorableFile class itself, not it's integration with the controller. Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
/packit test --labels sanity |
/packit retest-failed |
/packit test --labels sanity |
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.
Looks good to me.
The test failures doesn't seem related to the changes in the PR. Merging this now to unblock us with the next tasks. |
/packit test |
Tests failure seems to be unrelated. Merging this righ now to unblock other work. |
First part of the port for the remaining items for the BackupController.
Changes included in this work are:
Jira Issues: RHELC-1375
Checklist
[RHELC-]
is part of the PR titleRelease Pending
if relevant