Skip to content

Commit

Permalink
test-info.yml: add filesystem variant to the backend
Browse files Browse the repository at this point in the history
This helps us tailor tests for cases where the behaviour changes
according to the filesystem variant being used.

Signed-off-by: Sachin Prabhu <[email protected]>
  • Loading branch information
spuiuk committed Jul 9, 2024
1 parent 3a0ab60 commit 7bef503
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
4 changes: 3 additions & 1 deletion test-info.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ shares:
path: /mnt/share/export1-cephfs-vfs
backend:
# If present override default backend filesystem
name: cephfs.vfs
name: cephfs
# If present list the variant of the backend filesystem
variant: vfs
# If present, use these credentials to perform the
# tests for this share
users:
Expand Down
26 changes: 18 additions & 8 deletions testcases/smbtorture/test_smbtorture.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,26 @@

script_root = os.path.dirname(os.path.realpath(__file__))
smbtorture_exec = "/bin/smbtorture"
filter_subunit_exec = script_root + "/selftest/filter-subunit"
format_subunit_exec = script_root + "/selftest/format-subunit"
selftest_dir = script_root + "/selftest"
filter_subunit_exec = selftest_dir + "/filter-subunit"
format_subunit_exec = selftest_dir + "/format-subunit"
smbtorture_tests_file = script_root + "/smbtorture-tests-info.yml"

test_info_file = os.getenv("TEST_INFO_FILE")
test_info = testhelper.read_yaml(test_info_file)


def flapping_file(backend: str, variant: str = "") -> str:
file = "flapping." + backend
if variant:
file_variant = f"{file}-{variant}"
if os.path.exists(os.path.join(selftest_dir, file_variant)):
return file_variant
elif os.path.exists(os.path.join(selftest_dir, file)):
return file
return ""


def smbtorture(share_name: str, test: str, tmp_output: Path) -> bool:
# build smbtorture command
mount_params = testhelper.get_mount_parameters(test_info, share_name)
Expand Down Expand Up @@ -50,13 +62,11 @@ def smbtorture(share_name: str, test: str, tmp_output: Path) -> bool:
flapping_list = ["flapping", "flapping.d"]
share = testhelper.get_share(test_info, share_name)
test_backend = share["backend"].get("name")
test_backend_variant = share["backend"].get("variant")
if test_backend is not None:
flapping_file = "flapping." + test_backend
flapping_file_path = os.path.join(
script_root, "selftest", flapping_file
)
if os.path.exists(flapping_file_path):
flapping_list.append(flapping_file)
file = flapping_file(test_backend, test_backend_variant)
if file is not None:
flapping_list.append(file)
for filter in flapping_list:
filter_subunit_cmd.append(
"--flapping=" + script_root + "/selftest/" + filter
Expand Down

0 comments on commit 7bef503

Please sign in to comment.