Skip to content

Commit e939502

Browse files
committed
tests: adapt disk assessment check
fixes: cockpit-project#21728 Libblockdev changed how SmartFailing property is set. Now it is less strict with when a disk is considered as failing. storaged-project/libblockdev#1097
1 parent 146ef52 commit e939502

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

test/verify/check-storage-smart

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# You should have received a copy of the GNU Lesser General Public License
1818
# along with Cockpit; If not, see <https://www.gnu.org/licenses/>.
1919

20+
from os import getenv
2021
from sys import stderr
2122

2223
import storagelib
@@ -53,8 +54,10 @@ class TestStorageSmart(storagelib.StorageSmartCase):
5354
b.wait_in_text(self.card_desc("Device health (SMART)", "Self-test status"), status)
5455
if bad_sectors is not None:
5556
b.wait_in_text(self.card_desc("Device health (SMART)", "Number of bad sectors"), bad_sectors)
57+
b.wait_visible(self.card_desc("Device health (SMART)", "Number of bad sectors") + " .pf-m-warning")
5658
if failing_attrs is not None:
5759
b.wait_in_text(self.card_desc("Device health (SMART)", "Attributes failing"), failing_attrs)
60+
b.wait_visible(self.card_desc("Device health (SMART)", "Attributes failing") + " .pf-m-warning")
5861

5962
m = self.machine
6063
b = self.browser
@@ -82,17 +85,27 @@ class TestStorageSmart(storagelib.StorageSmartCase):
8285
set_smart_dump("INTEL_SSDSA2MH080G1GC--045C8820", "/dev/sda")
8386
check_smart_info("Disk is OK", "2309 hours", "Interrupted")
8487

85-
# Aborted self test and has known bad sector
88+
# latest libblockdev builds from copr have different behavior when assessing disk as failed
89+
is_nightly_scenario = "daily" in getenv("TEST_SCENARIO", "")
90+
91+
# Aborted self test and has known bad sector (overall assessment is still OK)
8692
set_smart_dump("ST9160821AS--3.CLH", "/dev/sda")
87-
check_smart_info("Disk is failing", "556 hours", "Aborted", bad_sectors="1")
93+
if is_nightly_scenario:
94+
check_smart_info("Disk is OK", "556 hours", "Aborted", bad_sectors="1")
95+
else:
96+
check_smart_info("Disk is failing", "556 hours", "Aborted", bad_sectors="1")
8897

8998
# Multiple bad sectors
9099
set_smart_dump("Maxtor_96147H8--BAC51KJ0", "/dev/sda")
91-
check_smart_info("Disk is failing", "2016 hours", "Successful", bad_sectors="71")
100+
if is_nightly_scenario:
101+
check_smart_info("Disk is OK", "2016 hours", "Successful", bad_sectors="71")
102+
else:
103+
check_smart_info("Disk is failing", "2016 hours", "Successful", bad_sectors="71")
92104

93105
# Multiple bad sectors with failing attribute
94106
set_smart_dump("Maxtor_96147H8--BAC51KJ0--2", "/dev/sda")
95107
check_smart_info("Disk is failing", "2262 hours", "Successful", bad_sectors="71", failing_attrs="1")
108+
b.wait_visible(self.card_desc("Device health (SMART)", "Assessment") + " .pf-m-danger")
96109

97110
# Check that SMART card is not visible on DVD drive
98111
b.go("/storage")

0 commit comments

Comments
 (0)