Refactor mdadm tests