From 6daf341749b4830d1e00d5ebedee62c8fb2fcac1 Mon Sep 17 00:00:00 2001 From: Filip Suba Date: Thu, 18 May 2023 15:00:27 +0200 Subject: [PATCH] Fix dmpd_functions test Related: #2175198 --- tests/functions_test/Makefile | 7 +++--- tests/functions_test/dmpd_functions.py | 35 ++++++++++++++------------ tests/functions_test/dmpd_library.py | 5 ++-- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/tests/functions_test/Makefile b/tests/functions_test/Makefile index 85cc8dd..d9e7f97 100644 --- a/tests/functions_test/Makefile +++ b/tests/functions_test/Makefile @@ -40,7 +40,7 @@ export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) BUILT_FILES= # data files, .c files, scripts anything needed to either compile the test and/or run it. -FILES=$(METADATA) runtest.sh PURPOSE +FILES=$(METADATA) runtest.sh PURPOSE testinfo.desc dmpd_functions.py dmpd_library.py Makefile run: $(FILES) build ./runtest.sh @@ -62,7 +62,7 @@ include /usr/share/rhts/lib/rhts-make.include $(METADATA): Makefile @touch $(METADATA) # Change to the test owner's name - @echo "Owner: Jakub Krysl " > $(METADATA) + @echo "Owner: Filip Suba " > $(METADATA) @echo "Name: $(TEST)" >> $(METADATA) @echo "Path: $(TEST_DIR)" >> $(METADATA) @echo "License: GPL" >> $(METADATA) @@ -71,6 +71,5 @@ $(METADATA): Makefile @echo "TestTime: 1h" >> $(METADATA) @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) - @echo "RhtsRequires: kernel-kernel-storage-misc-env_setup" >> $(METADATA) - rhts-lint $(METADATA) + rhts-lint $(METADATA) \ No newline at end of file diff --git a/tests/functions_test/dmpd_functions.py b/tests/functions_test/dmpd_functions.py index bcf02d6..686ada1 100755 --- a/tests/functions_test/dmpd_functions.py +++ b/tests/functions_test/dmpd_functions.py @@ -39,7 +39,7 @@ def thin_init(args): atomic_run("Creating thin pool", vg_name=args["group"], lv_name=args["pool"], - options=["-T", "-L 500"], + options=["-T", "-L 1500"], command=lvm.lv_create, errors=errors) @@ -48,7 +48,7 @@ def thin_init(args): atomic_run("Creating thin LV No. %s" % i, vg_name=args["group"] + "/" + args["pool"], lv_name=args["vol"] + str(i), - options=["-T", "-V 100"], + options=["-T", "-V 300"], command=lvm.lv_create, errors=errors) @@ -58,28 +58,16 @@ def thin_init(args): command=create_filesystem, errors=errors) - atomic_run("Deactivating thin LV No. %s" % i, - lv_name=args["vol"] + str(i), - vg_name=args["group"], - command=lvm.lv_deactivate, - errors=errors) - atomic_run("Creating metadata snapshot", lv_name=args["pool"], vg_name=args["group"], command=metadata_snapshot, errors=errors) - atomic_run("Deactivating pool", - lv_name=args["pool"], - vg_name=args["group"], - command=lvm.lv_deactivate, - errors=errors) - atomic_run("Creating swap LV", vg_name=args["group"], lv_name=args["swap"], - options=["-L 100"], + options=["-L 300"], command=lvm.lv_create, errors=errors) @@ -89,6 +77,19 @@ def thin_init(args): command=lvm.lv_deactivate, errors=errors) + atomic_run("Deactivating pool", + lv_name=args["pool"], + vg_name=args["group"], + command=lvm.lv_deactivate, + errors=errors) + + for i in range(args["number of vols"]): + atomic_run("Deactivating thin LV No. %s" % i, + lv_name=args["vol"] + str(i), + vg_name=args["group"], + command=lvm.lv_deactivate, + errors=errors) + atomic_run("Swapping metadata", vg_name=args["group"], lv_name=args["swap"], @@ -1111,6 +1112,7 @@ def cache_errors_test(args): # errors=errors) #FIXME: Find other way to corrupt metadata, this exploits a bug + """ atomic_run("Corrupting mappings on metadata device", False, source_file="Makefile", @@ -1139,7 +1141,7 @@ def cache_errors_test(args): source_lv=args['swap'], target_file="/tmp/metadata_repair", command=dmpd.cache_repair, - errors=errors) + errors=errors)""" atomic_run("Corrupting metadata on device", cmd="echo 'nothing' >> /dev/mapper/%s-%s" % (args['group'], args['swap']), @@ -1208,6 +1210,7 @@ def main(): "swap": "swapvol"} # Initialization + install_package("lvm2") install_package("device-mapper-persistent-data") # Tests for thin tools provided by device-mapper-persistent-data diff --git a/tests/functions_test/dmpd_library.py b/tests/functions_test/dmpd_library.py index a761fe5..1cf44df 100755 --- a/tests/functions_test/dmpd_library.py +++ b/tests/functions_test/dmpd_library.py @@ -195,7 +195,8 @@ def show_sys_info(): if run("rpm -q device-mapper-multipath") == 0: #Abort test execution if multipath is not working well if run("multipath -l 2>/dev/null") != 0: - sys.exit(1) + print("WARN: Multipath is not configured correctly") + return #Flush all unused multipath devices before starting the test run("multipath -F") run("multipath -r") @@ -606,7 +607,7 @@ class LogChecker: _print("WARN: Could not open %s" % log_msg_file) return True - log_file = open(log_msg_file) + log_file = open(log_msg_file, encoding="utf-8", errors="ignore") log = log_file.read() begin_tag = "\\[ cut here \\]"