Skip to content

Commit 5a031fc

Browse files
committed
testhelper: add option to allow direct access to share
Allow users to provide a direct access to the shar under share["backend"]["path"] This can be used to set up a test by performing operations directly on the underlying filesystem before the test is run over SMB. Signed-off-by: Sachin Prabhu <[email protected]>
1 parent a11493f commit 5a031fc

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

selftest/test-info1.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ shares:
1919
backend:
2020
# If present override default backend filesystem
2121
name: cephfs.vfs
22+
# if present, provide access to backend filesystem
23+
path: /mnt/backend/export1
2224
# If present, use these credentials to perform the
2325
# tests for this share
2426
users:

selftest/test_testhelper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def test_read_yaml1():
99
assert export1["server"] == "hostname1"
1010
assert export1["path"] == "/mnt/share/export1-cephfs-vfs"
1111
assert export1["backend"]["name"] == "cephfs.vfs"
12+
assert export1["backend"]["path"] == "/mnt/backend/export1"
1213
assert "user1" not in export1["users"]
1314
assert "test2" in export1["users"]
1415
assert export1["users"]["test2"] == "x"
@@ -17,6 +18,7 @@ def test_read_yaml1():
1718
assert export2["server"] == "server_name"
1819
assert "path" not in export2
1920
assert export2["backend"]["name"] == "glusterfs"
21+
assert export2["backend"]["path"] is None
2022
assert "test2" not in export2["users"]
2123
assert "user2" in export2["users"]
2224
assert export2["users"]["user2"] == "user2password"

test-info.yml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ shares:
1919
backend:
2020
# If present override default backend filesystem
2121
name: cephfs.vfs
22+
# If present, provide access to backend filesystem
23+
path: /mnt/backend/export1
2224
# If present, use these credentials to perform the
2325
# tests for this share
2426
users:

testhelper/testhelper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ def read_yaml(test_info_file):
5454
shares[sharename] = {"name": sharename}
5555
share = shares[sharename]
5656
share.setdefault("name", sharename)
57-
share.setdefault("backend", {})
5857
share.setdefault("server", default_server)
5958
share.setdefault("users", default_users)
59+
share.setdefault("backend", {})
6060
share["backend"].setdefault("name", default_backend)
61+
share["backend"].setdefault("path", None)
6162

6263
test_info["shares"] = shares
6364

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ commands = pytest -vrfEsxXpP testcases/consistency
3939
deps =
4040
pytest
4141
pyyaml
42+
pysmb
4243
changedir = {toxinidir}/selftest
4344
commands = pytest -vrfEsxXpP .
4445

0 commit comments

Comments
 (0)