Module: check_mk
Branch: master
Commit: c1946690e9eae65255f4351df77eb6bb1b0bb877
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c1946690e9eae6…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Oct 19 08:09:12 2018 +0200
test_df_check: refactor some tests to fix the actual results
Change-Id: I86778ea45d54398bc05935636b756999d49ccab1
---
.../generictests/datasets/df_lnx_regression.py | 48 ++++++++++++++++++++++
.../generictests/datasets/df_win_regression.py | 43 +++++++++++++++++++
tests/unit/checks/test_df_check.py | 7 ----
3 files changed, 91 insertions(+), 7 deletions(-)
diff --git a/tests/unit/checks/generictests/datasets/df_lnx_regression.py
b/tests/unit/checks/generictests/datasets/df_lnx_regression.py
new file mode 100644
index 0000000..e40052c
--- /dev/null
+++ b/tests/unit/checks/generictests/datasets/df_lnx_regression.py
@@ -0,0 +1,48 @@
+
+
+checkname = 'df'
+
+
+info = [[u'/dev/sda4',
+ u'ext4',
+ u'143786696',
+ u'101645524',
+ u'34814148',
+ u'75%',
+ u'/'],
+ [u'[df_inodes_start]'],
+ [u'/dev/sda4', u'ext4', u'9142272', u'1654272',
u'7488000', u'19%', u'/'],
+ [u'[df_inodes_end]']]
+
+
+discovery = {'': [(u'/', {})]}
+
+
+checks = {
+ '': [
+ (u'/', 'default',
+ [(0, '75.8% used (103.92 of 137.13 GB), trend: 0.00 B / 24 hours',
+ [(u'/', 106418.50390625, 112333.35625, 126375.02578125, 0,
140416.6953125),
+ ('fs_size', 140416.6953125, None, None, None, None),
+ ('growth', 0.0, None, None, None, None),
+ ('trend', 0, None, None, 0, 5850.695638020833),
+ ('inodes_used', 1654272, 8228044.8, 8685158.4, 0, 9142272),
+ ]
+ ),
+ ]
+ ),
+ (u'/dev/sda4 /', 'default',
+ [(0, '75.8% used (103.92 of 137.13 GB), trend: 0.00 B / 24 hours',
+ [(u'/', 106418.50390625, 112333.35625, 126375.02578125, 0,
140416.6953125),
+ ('fs_size', 140416.6953125, None, None, None, None),
+ ('growth', 0.0, None, None, None, None),
+ ('trend', 0, None, None, 0, 5850.695638020833),
+ ('inodes_used', 1654272, 8228044.8, 8685158.4, 0, 9142272),
+ ]
+ ),
+ ]
+ ),
+ (u'/home', 'default', [(3, 'filesystem not found', [])]
+ ),
+ ]
+}
diff --git a/tests/unit/checks/generictests/datasets/df_win_regression.py
b/tests/unit/checks/generictests/datasets/df_win_regression.py
new file mode 100644
index 0000000..4ba11d0
--- /dev/null
+++ b/tests/unit/checks/generictests/datasets/df_win_regression.py
@@ -0,0 +1,43 @@
+
+
+checkname = 'df'
+
+
+info = [[u'C:\\', u'NTFS', u'8192620', u'7724268',
u'468352', u'95%', u'C:\\'],
+ [u'New_Volume', u'NTFS', u'10240796', u'186256',
u'10054540', u'2%', u'E:\\'],
+ [u'New_Volume',
+ u'NTFS',
+ u'124929596',
+ u'50840432',
+ u'74089164',
+ u'41%',
+ u'F:\\']]
+
+
+discovery = {'': [(u'C:/', {}), (u'E:/', {}), (u'F:/',
{})]}
+
+
+checks = {'': [(u'C:/', 'default',
+ [(2, '94.3% used (7.37 of 7.81 GB), (warn/crit at 80.00/90.00%),
trend: 0.00 B / 24 hours',
+ [(u'C:/', 7543.23046875, 6400.484375, 7200.544921875, 0,
8000.60546875),
+ ('fs_size', 8000.60546875, None, None, None, None),
+ ('growth', 0.0, None, None, None, None),
+ ('trend', 0, None, None, 0, 333.3585611979167)])]),
+ (u'New_Volume E:/', 'default',
+ [(0, '1.82% used (181.89 MB of 9.77 GB), trend: 0.00 B / 24
hours',
+ [(u'E:/', 181.890625, 8000.621875, 9000.699609375, 0,
10000.77734375),
+ ('fs_size', 10000.77734375, None, None, None, None),
+ ('growth', 0.0, None, None, None, None),
+ ('trend', 0, None, None, 0, 416.6990559895833)])]),
+ (u'E:/', 'default',
+ [(0, '1.82% used (181.89 MB of 9.77 GB), trend: 0.00 B / 24
hours',
+ [(u'E:/', 181.890625, 8000.621875, 9000.699609375, 0,
10000.77734375),
+ ('fs_size', 10000.77734375, None, None, None, None),
+ ('growth', 0.0, None, None, None, None),
+ ('trend', 0, None, None, 0, 416.6990559895833)])]),
+ (u'F:/', 'default',
+ [(0, '40.7% used (48.49 of 119.14 GB), trend: 0.00 B / 24
hours',
+ [(u'F:/', 49648.859375, 97601.246875, 109801.402734375, 0,
122001.55859375),
+ ('fs_size', 122001.55859375, None, None, None, None),
+ ('growth', 0.0, None, None, None, None),
+ ('trend', 0, None, None, 0, 5083.398274739583)])])]}
diff --git a/tests/unit/checks/test_df_check.py b/tests/unit/checks/test_df_check.py
index 51e9e55..4c023e5 100644
--- a/tests/unit/checks/test_df_check.py
+++ b/tests/unit/checks/test_df_check.py
@@ -240,10 +240,8 @@ info_empty_inodes = [
@pytest.mark.parametrize("info,expected_result,inventory_df_rules", [
([], [], {}),
- (info_df_lnx, [(u'/', {})], {}),
# Linux
(info_df_lnx, [(u'/', {})], { "include_volume_name" : False }),
# Linux w/ volume name unset
(info_df_lnx, [(u'/dev/sda4 /', {})], { "include_volume_name" :
True}), # Linux w/ volume name option
- (info_df_win, [(u'E:/', {}), (u'F:/', {}), (u'C:/', {})],
{}), # Windows
(info_df_win, [(u'New_Volume E:/', {}), (u'New_Volume F:/', {}),
(u'C:\\ C:/', {})],
{
"include_volume_name" : True }), # Windows w/ volume name option
(info_df_lnx_tmpfs, [], {}),
# Ignoring tmpfs
@@ -279,12 +277,7 @@ def test_df_discovery_with_parse(check_manager, info,
expected_result, inventory
@pytest.mark.parametrize("item,params,info,expected_result", [
- (u"/", "default", info_df_lnx, {}),
- (u'/dev/sda4 /', "default", info_df_lnx, {}),
- (u'E:/', "default", info_df_win, {}),
- (u'New_Volume E:/', "default", info_df_win, {}),
(u'btrfs /dev/sda1', "default", info_df_btrfs, {}),
- (u"/home", "default", info_df_lnx, {}), # When called with an
item not found in info, the check should not crash.
])
def test_df_check_with_parse(check_manager, item, params, info, expected_result):
check = check_manager.get_check("df")