From f2d72d46d425be07a7bea171e2025f8487ac2b9f Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Sun, 7 Oct 2018 15:09:25 +0300 Subject: [PATCH] qa/workunits/rbd: fix cli generic namespace test expect_fail incorrectly unset '-e' option and if a consequent test failed it did not abort the execution. And two typos in the namespace tests were not detected due to this. Signed-off-by: Mykola Golub --- qa/workunits/rbd/cli_generic.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/qa/workunits/rbd/cli_generic.sh b/qa/workunits/rbd/cli_generic.sh index 7b1f41cec2005..3f22893648087 100755 --- a/qa/workunits/rbd/cli_generic.sh +++ b/qa/workunits/rbd/cli_generic.sh @@ -10,12 +10,8 @@ rbd ls | wc -l | grep -v '^0$' && echo "nonempty rbd pool, aborting! run this s IMGS="testimg1 testimg2 testimg3 testimg4 testimg5 testimg6 testimg-diff1 testimg-diff2 testimg-diff3 foo foo2 bar bar2 test1 test2 test3 test4 clone2" -expect_fail() -{ - set -x - set +e - "$@" - if [ $? == 0 ]; then return 1; else return 0; fi +expect_fail() { + "$@" && return 1 || return 0 } tiered=0 @@ -644,7 +640,7 @@ test_namespace() { rbd snap create rbd/test1/image1@1 rbd clone --rbd-default-clone-format 2 rbd/test1/image1@1 rbd/test2/image1 rbd snap rm rbd/test1/image1@1 - cmp <(rbd export rbd/test1/image1@1 -) <(rbd export rbd/test2/image1 -) + cmp <(rbd export rbd/test1/image1 -) <(rbd export rbd/test2/image1 -) rbd rm rbd/test2/image1 # default ns to test1 ns clone @@ -653,7 +649,7 @@ test_namespace() { rbd snap create rbd/image2@1 rbd clone --rbd-default-clone-format 2 rbd/image2@1 rbd/test2/image2 rbd snap rm rbd/image2@1 - cmp <(rbd export rbd/image2@1 -) <(rbd export rbd/test2/image2 -) + cmp <(rbd export rbd/image2 -) <(rbd export rbd/test2/image2 -) expect_fail rbd rm rbd/image2 rbd rm rbd/test2/image2 rbd rm rbd/image2 -- 2.39.5