1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

fix vgreduce tests to detect partial command failure (Jaroslav Stava)

This commit is contained in:
Milan Broz 2008-08-28 11:20:49 +00:00
parent cfeb1d3442
commit 8695f2cecb

View File

@ -35,28 +35,39 @@ test_expect_success \
lv2=$(this_test_)-test-lv2-$$ && lv2=$(this_test_)-test-lv2-$$ &&
lv3=$(this_test_)-test-lv3-$$' lv3=$(this_test_)-test-lv3-$$'
#TODO --removemissing (+ -- mirrorsonly)
for mdatype in 1 2 for mdatype in 1 2
do do
test_expect_success \ test_expect_success \
"(lvm$mdatype) setup PVs" ' "(lvm$mdatype) setup PVs" '
pvcreate -M$mdatype $d1 $d2 pvcreate -M$mdatype $d1 $d2
'
test_expect_success \
"(lvm$mdatype) vgreduce removes only the specified pv from vg (bz427382)" '
vgcreate -M$mdatype $vg1 $d1 $d2 &&
vgreduce $vg1 $d1 &&
check_pv_field_ $d2 vg_name $vg1 &&
vgremove -f $vg1
' '
test_expect_success \ test_expect_success \
"(lvm$mdatype) vgreduce rejects removing the last pv (--all)" ' "(lvm$mdatype) vgreduce rejects removing the last pv (--all)" '
vgcreate -M$mdatype $vg1 $d1 $d2 && vgcreate -M$mdatype $vg1 $d1 $d2 &&
vgreduce --all $vg1 2>err; { vgreduce --all $vg1;
vgremove -f $vg1 status=$?; echo status=$status; test $status != 0 &&
vgremove -f $vg1
}
' '
#status=$?; echo status=$status; test $status = 5 &&
test_expect_success \ test_expect_success \
"(lvm$mdatype) vgreduce rejects removing the last pv" ' "(lvm$mdatype) vgreduce rejects removing the last pv" '
vgcreate -M$mdatype $vg1 $d1 $d2 && vgcreate -M$mdatype $vg1 $d1 $d2 &&
vgreduce $vg1 $d1 $d2 2>err; { vgreduce $vg1 $d1 $d2;
status=$?; echo status=$status; test $status = 5 && status=$?; echo status=$status; test $status = 5 &&
vgremove -f $vg1 vgremove -f $vg1
}
' '
test_expect_success \ test_expect_success \
@ -65,21 +76,21 @@ test_expect_success \
' '
done done
## TODO --mirrorsonly ?
for mdatype in 2 for mdatype in 2
do do
test_expect_success \ test_expect_success \
"(lvm$mdatype) setup PVs (--metadatacopies 0)" ' "(lvm$mdatype) setup PVs (--metadatacopies 0)" '
pvcreate -M$mdatype $d1 $d2 pvcreate -M$mdatype $d1 $d2 &&
pvcreate --metadatacopies 0 -M$mdatype $d3 $d4 pvcreate --metadatacopies 0 -M$mdatype $d3 $d4
' '
test_expect_success \ test_expect_success \
"(lvm$mdatype) vgreduce rejects removing pv with the last mda copy" ' "(lvm$mdatype) vgreduce rejects removing pv with the last mda copy" '
vgcreate -M$mdatype $vg1 $d1 $d3 && vgcreate -M$mdatype $vg1 $d1 $d3 &&
vgreduce $vg1 $d1 2>err; { vgreduce $vg1 $d1;
status=$?; echo status=$status; test $status != 0 && status=$?; echo status=$status; test $status != 0 &&
vgremove -f $vg1 vgremove -f $vg1
}
' '
done done