forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_esx_vsphere_hostsystem_multipath.py
80 lines (74 loc) · 2.78 KB
/
test_esx_vsphere_hostsystem_multipath.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python3
# Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
import pytest
from cmk.checkengine.checking import CheckPluginName
from cmk.base.api.agent_based.register import AgentBasedPlugins
from cmk.agent_based.v1 import Result, State
from cmk.agent_based.v1.type_defs import CheckResult
from cmk.plugins.lib.esx_vsphere import Section
@pytest.mark.parametrize(
"section, item, check_results",
[
(
Section(
[
(
"config.storageDevice.multipathInfo",
[
"73854743",
"bla1:A0:B7:C0",
"active",
"8390487493837394957202736469161739476594",
"bla3:A0:B0:C0",
"active",
"bla3:A0:B2:C0",
"active",
"52436384763283284389549439394844",
"bla2:A0:B2:C21",
"active",
"52436384763283284389549439394844",
"bla4:A0:B0:C21",
"active",
"52436384763283284389549439394844",
"bla4:A0:B1:C21",
"active",
"52436384763283284389549439394844",
"bla2:A0:B0:C21",
"active",
],
),
]
),
"bla2:A0:B2:C21",
[
Result(
state=State.OK,
summary="0 active, 0 dead, 0 disabled, 0 standby, 0 unknown",
details="0 active, 0 dead, 0 disabled, 0 standby, 0 unknown\nIncluded Paths:\nactive",
),
],
),
(
Section(
[
(
"config.storageDevice.multipathInfo",
[],
),
]
),
"52436384763283284389549439394844",
[],
),
],
)
def test_check_esx_vsphere_hostsystem_multipath(
agent_based_plugins: AgentBasedPlugins, section: Section, item: str, check_results: CheckResult
) -> None:
check = agent_based_plugins.check_plugins[CheckPluginName("esx_vsphere_hostsystem_multipath")]
assert (
list(check.check_function(item=item, params={"levels_map": {}}, section=section))
== check_results
)