Skip to content
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 unit.beacons.test_diskusage on Windows #50282

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions tests/unit/beacons/test_diskusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ def test_empty_config(self):

def test_diskusage_match(self):
disk_usage_mock = Mock(side_effect=STUB_DISK_USAGE)
with patch('psutil.disk_partitions',
MagicMock(return_value=STUB_DISK_PARTITION)), \
patch('psutil.disk_usage', disk_usage_mock):
with patch('salt.utils.platform.is_windows',
MagicMock(return_value=False)),\
patch('psutil.disk_partitions',
MagicMock(return_value=STUB_DISK_PARTITION)), \
patch('psutil.disk_usage', disk_usage_mock):
config = [{'/': '50%'}]

ret = diskusage.validate(config)
Expand All @@ -88,8 +90,10 @@ def test_diskusage_match(self):

def test_diskusage_nomatch(self):
disk_usage_mock = Mock(side_effect=STUB_DISK_USAGE)
with patch('psutil.disk_partitions',
MagicMock(return_value=STUB_DISK_PARTITION)), \
with patch('salt.utils.platform.is_windows',
MagicMock(return_value=False)),\
patch('psutil.disk_partitions',
MagicMock(return_value=STUB_DISK_PARTITION)), \
patch('psutil.disk_usage', disk_usage_mock):
config = [{'/': '70%'}]

Expand All @@ -102,8 +106,10 @@ def test_diskusage_nomatch(self):

def test_diskusage_match_regex(self):
disk_usage_mock = Mock(side_effect=STUB_DISK_USAGE)
with patch('psutil.disk_partitions',
MagicMock(return_value=STUB_DISK_PARTITION)), \
with patch('salt.utils.platform.is_windows',
MagicMock(return_value=False)),\
patch('psutil.disk_partitions',
MagicMock(return_value=STUB_DISK_PARTITION)), \
patch('psutil.disk_usage', disk_usage_mock):
config = [{r'^\/': '50%'}]

Expand Down