diff options
author | mwilck@arcor.de <mwilck@arcor.de> | 2013-08-02 00:35:17 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-08-05 12:04:56 +1000 |
commit | 57631ca2ff921d17097f2e44d5db306be3736052 (patch) | |
tree | d7db09e634a43119b8ee4a1d87f563882b019d6b /tests | |
parent | 9591a2de77fa405f7e7d728a8e6c623808f57432 (diff) | |
download | mdadm-57631ca2ff921d17097f2e44d5db306be3736052.tar.gz |
tests/10ddf-fail-twice: New unit test
This is the test by Albert Pauw. Fail 2 disks, and add one.
Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/10ddf-fail-twice | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/10ddf-fail-twice b/tests/10ddf-fail-twice new file mode 100644 index 0000000..042b77b --- /dev/null +++ b/tests/10ddf-fail-twice @@ -0,0 +1,56 @@ +# sanity check array creation + +ddf_check_hold() { + if mdadm --remove $1 $2; then + echo "$2 removal from $1 should have been blocked" >&2 + cat /proc/mdstat >&2 + mdadm -E $2 + exit 1 + fi +} + +ddf_check_removal() { + if ! mdadm --remove $1 $2 ; then + echo "$2 removal from $1 should have succeeded" >&2 + cat /proc/mdstat >&2 + mdadm -E $2 + exit 1 + fi +} + +. tests/env-ddf-template + +num_disks=5 +mdadm -CR $container -e ddf -n $num_disks $dev8 $dev9 $dev10 $dev11 $dev12 +ddf_check container $num_disks + +mdadm -CR $member0 -n 2 -l 1 $container +mdadm -CR $member1 -n 3 -l 5 $container + +mdadm --wait $member1 $member0 || mdadm --wait $member1 $member0 + +mdadm $member0 --fail $dev11 +mdadm $member1 --fail $dev9 + +mdadm $container --add $dev13 + +mdadm --wait $member1 $member0 || mdadm --wait $member1 $member0 + +{ grep -q 'external:/md127/1.*\[3/3\]' /proc/mdstat && + grep -q 'external:/md127/0.*\[2/1\]' /proc/mdstat; } || { + echo unexpected states in /proc/mdstat + cat /proc/mdstat + mdadm -Ss + exit 1 +} + +{ mdadm -E $dev10 | grep -q 'state\[0\] : Degraded, Consistent' && + mdadm -E $dev10 | grep -q 'state\[1\] : Optimal, Consistent'; } || { + echo unexpected meta data state + mdadm -E $dev10 + mdadm -Ss + exit 1 +} + +mdadm -Ss +exit 0 |