From 374a0f678817c1ab054587def008e65806f9c437 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 13 Dec 2023 14:28:00 +0900
Subject: [PATCH 0182/1160] test: mask mdmonitor when building image

Follow-up for 22e31655f3f9f54d932d4f48b92b36698e701729.

(cherry picked from commit 0f236e8cd6309cdc392d9e62bc545dcd497a9c50)
---
 test/test-functions        | 4 ++++
 test/units/testsuite-64.sh | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/test-functions b/test/test-functions
index 2fc207e44c..3fd795b9f7 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -1299,6 +1299,10 @@ install_mdadm() {
     for unit in "${mdadm_units[@]}"; do
         image_install "${ROOTLIBDIR:?}/$unit"
     done
+
+    # Disable the mdmonitor service, since it fails if there's no valid email address
+    # configured in /etc/mdadm.conf, which just unnecessarily pollutes the logs
+    "${SYSTEMCTL:?}" mask --root "${initdir:?}" mdmonitor.service || :
 }
 
 install_compiled_systemd() {
diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh
index 299c5eb183..65e5f6cd91 100755
--- a/test/units/testsuite-64.sh
+++ b/test/units/testsuite-64.sh
@@ -1164,10 +1164,6 @@ testcase_mdadm_lvm() {
     helper_check_device_units
 }
 
-# Disable the mdmonitor service, since it fails if there's no valid email address
-# configured in /etc/mdadm.conf, which just unnecessarily pollutes the logs
-systemctl list-unit-files mdmonitor.service >/dev/null && systemctl mask --runtime mdmonitor.service
-
 udevadm settle
 udevadm control --log-level debug
 lsblk -a
-- 
2.33.0