From 023b89992a8e2398fa619619b74a69a5bf0227ca Mon Sep 17 00:00:00 2001 From: Mateusz Kusiak Date: Tue, 3 Dec 2024 11:05:56 +0100 Subject: tests: fix 09imsm-assemble Refactor imsm_check_removal() to give mdadm a chance to remove the device, add retries. Signed-off-by: Mateusz Kusiak --- tests/09imsm-assemble | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/09imsm-assemble b/tests/09imsm-assemble index d7028c62..9b04aa97 100644 --- a/tests/09imsm-assemble +++ b/tests/09imsm-assemble @@ -12,12 +12,23 @@ imsm_check_hold() { } imsm_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 + local ret=5 + local success=0 + + for ((i=1; i<=ret; i++)); do + if mdadm --remove "$1" "$2"; then + success=1 + break + fi + sleep 1 + done + + if [ $success -ne 1 ]; then + echo "$2 removal from $1 should have succeeded" >&2 + cat /proc/mdstat >&2 + mdadm -E "$2" + exit 1 + fi } export IMSM_DEVNAME_AS_SERIAL=1 -- cgit v1.2.3