Skip to content

Commit

Permalink
testhelper: add directmnt and get_share()
Browse files Browse the repository at this point in the history
Add an additional entity directmnt which points to the mount to the
underlying filesystem.

Also add get_share() to get the share entity.

Signed-off-by: Sachin Prabhu <[email protected]>
  • Loading branch information
spuiuk committed Feb 7, 2024
1 parent f271713 commit f761bb5
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion testhelper/testhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,21 @@ def get_shares(test_info: dict) -> typing.List[dict]:
default_fs = test_info.get("test_backend", None)
arr = []
for sharename in test_info.get("exported_sharenames", []):
arr.append({"name": sharename, "mntdir": None, "fs": default_fs})
arr.append(
{
"name": sharename,
"mntdir": None,
"fs": default_fs,
"directmnt": None,
}
)
for share in test_info.get("exported_shares", []):
arr.append(
{
"name": share.get("name", None),
"mntdir": share.get("mntdir", None),
"fs": share.get("fs", default_fs),
"directmnt": share.get("directmnt", None),
}
)
test_info["shares"] = arr
Expand All @@ -122,6 +130,22 @@ def get_share(test_info: dict, sharename: str) -> dict:
return {}


def get_shares_with_directmnt(test_info: dict) -> typing.List[dict]:
"""
Get list of shares with directmnt enabled
Parameters:
test_info: Dict containing the parsed yaml file.
Returns:
list of shares
"""
arr = []
for share in get_shares(test_info):
if share["directmnt"] is not None:
arr.append(share)
return arr


def is_premounted_share(share: dict) -> bool:
"""
Is the share dict a premounted share
Expand Down

0 comments on commit f761bb5

Please sign in to comment.