mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
tests: update no tool test
Correct testing with format 1 and mq policy. Add testing of 'smq' Fix testing with clvmd - where logged message is part of clvmd log and we can only check command status.
This commit is contained in:
parent
4e0c0417ce
commit
8c02cc9e8f
@ -17,65 +17,104 @@ SKIP_WITH_LVMPOLLD=1
|
|||||||
|
|
||||||
. lib/inittest
|
. lib/inittest
|
||||||
|
|
||||||
|
if test -e LOCAL_CLVMD ; then
|
||||||
|
# In cluster, the error from activation is logged in clvmd
|
||||||
|
# so we can only check resulting state of activation
|
||||||
|
GREP=echo
|
||||||
|
else
|
||||||
|
GREP=grep
|
||||||
|
fi
|
||||||
|
|
||||||
|
make_fake_() {
|
||||||
|
cat <<- EOF >fake-tool.sh
|
||||||
|
#!/bin/sh
|
||||||
|
echo "$1"
|
||||||
|
exit 1
|
||||||
|
EOF
|
||||||
|
chmod +x fake-tool.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
check_change_() {
|
||||||
|
lvchange -an $vg |& tee out
|
||||||
|
"$GREP" "$1" out
|
||||||
|
|
||||||
|
lvchange -ay $vg |& tee out
|
||||||
|
"$GREP" "$1" out
|
||||||
|
}
|
||||||
|
|
||||||
|
# Integrity check fails, but deactivation is OK
|
||||||
|
check_change_failed_() {
|
||||||
|
lvchange -an $vg |& tee out
|
||||||
|
"$GREP" "failed" out
|
||||||
|
|
||||||
|
# Activation must fail
|
||||||
|
fail lvchange -ay $vg |& tee out
|
||||||
|
"$GREP" "failed" out
|
||||||
|
|
||||||
|
cat <<- EOF >fake-tool.sh
|
||||||
|
#!/bin/sh
|
||||||
|
exit
|
||||||
|
EOF
|
||||||
|
chmod +x fake-tool.sh
|
||||||
|
# Activate without any check
|
||||||
|
lvchange -ay $vg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
aux have_cache 1 3 0 || skip
|
aux have_cache 1 3 0 || skip
|
||||||
|
|
||||||
# FIXME: parallel cache metadata allocator is crashing when used value 8000!
|
# FIXME: parallel cache metadata allocator is crashing when used value 8000!
|
||||||
aux prepare_vg 5 80000
|
aux prepare_vg 5 80000
|
||||||
|
|
||||||
aux lvmconf 'global/cache_disabled_features = [ "policy_smq" ]' \
|
aux lvmconf 'global/cache_check_executable = "./fake-tool.sh"'
|
||||||
'global/cache_check_executable = "./fake-tool.sh"'
|
|
||||||
|
|
||||||
rm -f fake-tool.sh
|
rm -f fake-tool.sh
|
||||||
|
|
||||||
lvcreate -l1 -n $lv1 $vg
|
# On cache target that supports V2
|
||||||
|
if aux have_cache 1 10 0 ; then
|
||||||
|
|
||||||
|
lvcreate -aey -l1 -n $lv1 $vg
|
||||||
lvcreate -H -l2 $vg/$lv1
|
lvcreate -H -l2 $vg/$lv1
|
||||||
|
|
||||||
lvchange -an $vg |& tee out
|
check_change_ "Check is skipped"
|
||||||
grep "Check is skipped" out
|
vgcfgbackup -f /dev/shm/back
|
||||||
|
|
||||||
lvchange -ay $vg
|
|
||||||
grep "Check is skipped" out
|
|
||||||
|
|
||||||
# prepare fake version of cache_check tool that reports old version
|
# prepare fake version of cache_check tool that reports old version
|
||||||
cat <<- EOF >fake-tool.sh
|
make_fake_ "0.1.0"
|
||||||
#!/bin/sh
|
check_change_ "upgrade"
|
||||||
echo "0.1.0"
|
|
||||||
exit 1
|
|
||||||
EOF
|
|
||||||
chmod +x fake-tool.sh
|
|
||||||
|
|
||||||
lvchange -an $vg |& tee out
|
|
||||||
grep "upgrade" out
|
|
||||||
|
|
||||||
lvchange -ay $vg
|
|
||||||
grep "upgrade" out
|
|
||||||
|
|
||||||
# prepare fake version of cache_check tool that reports garbage
|
# prepare fake version of cache_check tool that reports garbage
|
||||||
cat <<- EOF >fake-tool.sh
|
make_fake_ "garbage"
|
||||||
#!/bin/sh
|
check_change_ "parse"
|
||||||
echo "garbage"
|
|
||||||
exit 1
|
|
||||||
EOF
|
|
||||||
chmod +x fake-tool.sh
|
|
||||||
|
|
||||||
lvchange -an $vg |& tee out
|
|
||||||
grep "parse" out
|
|
||||||
|
|
||||||
lvchange -ay $vg
|
|
||||||
grep "parse" out
|
|
||||||
|
|
||||||
# prepare fake version of cache_check tool with high version
|
# prepare fake version of cache_check tool with high version
|
||||||
cat <<- EOF >fake-tool.sh
|
make_fake_ "99.0.0"
|
||||||
#!/bin/sh
|
check_change_failed_
|
||||||
echo "9.0.0"
|
|
||||||
exit 1
|
lvremove -f $vg
|
||||||
EOF
|
|
||||||
chmod +x fake-tool.sh
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# On older cache target that supports only V1 format
|
||||||
|
aux lvmconf 'global/cache_disabled_features = [ "policy_smq" ]'
|
||||||
|
rm -f fake-tool.sh
|
||||||
|
|
||||||
|
lvcreate -aey -l1 -n $lv1 $vg
|
||||||
|
lvcreate -H -l2 $vg/$lv1
|
||||||
|
|
||||||
|
check_change_ "Check is skipped"
|
||||||
|
|
||||||
|
# prepare fake version of cache_check tool that reports old version
|
||||||
|
make_fake_ "0.1.0"
|
||||||
|
check_change_failed_
|
||||||
|
|
||||||
|
# prepare fake version of cache_check tool that reports garbage
|
||||||
|
make_fake_ "garbage"
|
||||||
|
check_change_failed_
|
||||||
|
|
||||||
|
# prepare fake version of cache_check tool with high version
|
||||||
|
make_fake_ "99.0.0"
|
||||||
|
check_change_failed_
|
||||||
|
|
||||||
# Integrity check fails, but deactivation is OK
|
|
||||||
lvchange -an $vg |& tee out
|
|
||||||
grep "failed" out
|
|
||||||
# Activation must fail
|
|
||||||
fail lvchange -ay $vg
|
|
||||||
|
|
||||||
vgremove -ff $vg
|
vgremove -ff $vg
|
||||||
|
Loading…
Reference in New Issue
Block a user