-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |