Skip to content

Commit 10aedb2

Browse files
committed
testhelper: add directmnt and get_share()
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]>
1 parent bb6bac9 commit 10aedb2

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

testhelper/testhelper.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,23 @@ def get_shares(test_info: dict) -> typing.List[dict]:
9494
arr = []
9595
exported_sharenames = test_info.get("exported_sharenames") or []
9696
for sharename in exported_sharenames:
97-
arr.append({"name": sharename, "mntdir": None, "fs": default_fs})
97+
arr.append(
98+
{
99+
"name": sharename,
100+
"mntdir": None,
101+
"fs": default_fs,
102+
"directmnt": None,
103+
}
104+
)
105+
98106
exported_shares = test_info.get("exported_shares") or []
99107
for share in exported_shares:
100108
arr.append(
101109
{
102110
"name": share.get("name"),
103111
"mntdir": share.get("mntdir"),
104112
"fs": share.get("fs", default_fs),
113+
"directmnt": share.get("directmnt"),
105114
}
106115
)
107116
test_info["shares"] = arr
@@ -124,6 +133,22 @@ def get_share(test_info: dict, sharename: str) -> dict:
124133
return {}
125134

126135

136+
def get_shares_with_directmnt(test_info: dict) -> typing.List[dict]:
137+
"""
138+
Get list of shares with directmnt enabled
139+
140+
Parameters:
141+
test_info: Dict containing the parsed yaml file.
142+
Returns:
143+
list of shares
144+
"""
145+
arr = []
146+
for share in get_shares(test_info):
147+
if share["directmnt"] is not None:
148+
arr.append(share)
149+
return arr
150+
151+
127152
def is_premounted_share(share: dict) -> bool:
128153
"""
129154
Check if the share is a premounted share

0 commit comments

Comments
 (0)