Skip to content

Commit

Permalink
add more fenced tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yocalebo committed Sep 27, 2024
1 parent 15e3a7d commit c572270
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/unit/test_fenced.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pytest

from fenced.main import parse_ed
from fenced.utils import load_disks_from_sys_block


@pytest.mark.parametrize(
"exclude,expected",
[
("sda,", ("sda",)),
("", ()),
("sda,sdb", ("sda", "sdb")),
("sda, sdb", ("sda", "sdb")),
("sda,sdb sdc", ("sda", "sdb", "sdc")),
("sda sdb sdc", ("sda", "sdb", "sdc")),
("sda sdb sdc", ("sda", "sdb", "sdc")),
],
)
def test_parse_ed(exclude, expected):
assert parse_ed(exclude) == expected


@pytest.mark.parametrize("exclude", [tuple(), ("sda"), ("sda,sdb")])
def test_load_disks_from_sys_block(exclude):
"""We need to make sure that fenced always enumerates
a list of disks."""
disks = load_disks_from_sys_block(exclude)
assert disks
for disk in exclude:
assert disk not in disks

0 comments on commit c572270

Please sign in to comment.