Skip to content

Commit 5290051

Browse files
committed
testhelper: allow users to override sharename
There could be some rare cases where the user may want to simultaneously test two different SMB servers exporting the same sharename. In that case, we cannot just use the sharename label as the sharename. In such instances, allow the user to override the sharename by specifing a name within the share definition. Signed-off-by: Sachin Prabhu <[email protected]>
1 parent 4728933 commit 5290051

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

selftest/test-info1.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ backend: glusterfs
1313
shares:
1414
# share export1
1515
export1:
16+
# if present, use this sharename instead of label
17+
name: export1-share
1618
# If present, it means the share is pre-mounted
1719
# at the location given
1820
path: /mnt/share/export1-cephfs-vfs

selftest/test_testhelper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def test_read_yaml1():
77

88
export1 = testinfo["shares"]["export1"]
99
assert export1["server"] == "hostname1"
10+
assert export1["name"] == "export1-share"
1011
assert export1["path"] == "/mnt/share/export1-cephfs-vfs"
1112
assert export1["backend"]["name"] == "cephfs.vfs"
1213
assert "user1" not in export1["users"]

test-info.yml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ backend: glusterfs
1313
shares:
1414
# share export1
1515
export1:
16+
# if present, use this sharename instead of label
17+
name: export1-share
1618
# If present, it means the share is pre-mounted
1719
# at the location given
1820
path: /mnt/share/export1-cephfs-vfs

testhelper/testhelper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def read_yaml(test_info_file):
5656
if shares[sharename] is None:
5757
shares[sharename] = {"name": sharename}
5858
share = shares[sharename]
59-
share.setdefault("name", share)
59+
share.setdefault("name", sharename)
6060
share.setdefault("backend", {})
6161
share.setdefault("server", default_server)
6262
share.setdefault("users", default_users)
@@ -99,10 +99,11 @@ def get_mount_parameters(test_info: dict, share: str) -> typing.Dict[str, str]:
9999
"""
100100
s = get_share(test_info, share)
101101
server = s["server"]
102+
sharename = s["name"]
102103
users = list(s["users"].keys())
103104
return gen_mount_params(
104105
server,
105-
share,
106+
sharename,
106107
users[0],
107108
s["users"][users[0]],
108109
)

0 commit comments

Comments
 (0)