-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add tests for minimum free disk space check #7
base: main
Are you sure you want to change the base?
Conversation
"/usr": {"source": "/dev/sda1", "target": "/", "avail": req_sum}, | ||
"/var": {"source": "/dev/sdb1", "target": "/var", "avail": self._requirements["/var"]}, | ||
} | ||
with mock.patch( |
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.
We are going to mock all subprocess.run function calls here, this could cause issues when we add more function calls within check_min_free_disk_space
.
@@ -158,6 +158,60 @@ class MinFreeDiskSpaceViolation(typing.NamedTuple): | |||
"""Paths belonging to this device.""" | |||
|
|||
|
|||
def check_min_free_disk_space(requirements: typing.Dict[str, int]) -> typing.List[MinFreeDiskSpaceViolation]: |
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 believe we could split this function into two parts - retrieving data from the findmnt
utility and check restrictions. So in tests we could just mock the retriving data function itself, but not the subprocess.run
.
from pleskdistup.common import log | ||
|
||
|
||
def init_logger(): |
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.
We could move the change into separated commit. Something like: "Enable logging for tests"
No description provided.