mirror of
https://github.com/thegeeklab/prometheus-pve-sd.git
synced 2024-11-22 01:10:39 +00:00
chore: use parametrized tests for input and output tests (#194)
This commit is contained in:
parent
d5d00e849b
commit
99e20663a7
@ -50,39 +50,29 @@ def test_exclude_tags(discovery, qemus):
|
||||
assert len(filtered) == 2
|
||||
|
||||
|
||||
def test_include_tags(discovery, qemus):
|
||||
discovery.config.config["include_tags"] = ["monitored"]
|
||||
@pytest.mark.parametrize(
|
||||
"testinput,expected", [
|
||||
(["monitored"], 1),
|
||||
(["monitored", "postgres"], 2),
|
||||
([], 3),
|
||||
]
|
||||
)
|
||||
def test_include_tags(discovery, qemus, testinput, expected):
|
||||
discovery.config.config["include_tags"] = testinput
|
||||
filtered = discovery._filter(qemus)
|
||||
|
||||
assert len(filtered) == 1
|
||||
assert len(filtered) == expected
|
||||
|
||||
|
||||
def test_include_tags_multiple(discovery, qemus):
|
||||
discovery.config.config["include_tags"] = ["monitored", "postgres"]
|
||||
@pytest.mark.parametrize("testinput,expected", [
|
||||
(["101", "100"], 2),
|
||||
([], 3),
|
||||
])
|
||||
def test_include_vmid(discovery, qemus, testinput, expected):
|
||||
discovery.config.config["include_vmid"] = testinput
|
||||
filtered = discovery._filter(qemus)
|
||||
|
||||
assert len(filtered) == 2
|
||||
|
||||
|
||||
def test_include_tags_empty(discovery, qemus):
|
||||
discovery.config.config["include_tags"] = []
|
||||
filtered = discovery._filter(qemus)
|
||||
|
||||
assert len(filtered) == 3
|
||||
|
||||
|
||||
def test_include_vmid(discovery, qemus):
|
||||
discovery.config.config["include_vmid"] = ["101", "100"]
|
||||
filtered = discovery._filter(qemus)
|
||||
|
||||
assert len(filtered) == 2
|
||||
|
||||
|
||||
def test_include_vmid_empty(discovery, qemus):
|
||||
discovery.config.config["include_vmid"] = []
|
||||
filtered = discovery._filter(qemus)
|
||||
|
||||
assert len(filtered) == 3
|
||||
assert len(filtered) == expected
|
||||
|
||||
|
||||
def test_include_and_exclude_tags(discovery, qemus):
|
||||
|
Loading…
Reference in New Issue
Block a user