@@ -42,10 +42,10 @@ class TestStorageSmart(storagelib.StorageSmartCase):
42
42
43
43
return version > (2 , 10 , 1 )
44
44
45
- def testSmart (self ):
46
- def set_smart_dump (name : str , block : str ):
47
- self .machine .execute (f"udisksctl smart-simulate -f /tmp/smart-dumps/{ name } -b { block } " )
45
+ def set_smart_dump (self , name : str , block : str ):
46
+ self .machine .execute (f"udisksctl smart-simulate -f /tmp/smart-dumps/{ name } -b { block } " )
48
47
48
+ def testSmart (self ):
49
49
def check_smart_info (assessment : str , hours : str , status : str , bad_sectors : str | None = None ,
50
50
failing_attrs : str | None = None ):
51
51
self .assertIn (assessment , b .text (self .card_desc ("Device health (SMART)" , "Assessment" )))
@@ -66,7 +66,7 @@ class TestStorageSmart(storagelib.StorageSmartCase):
66
66
67
67
m .upload (["verify/files/smart-dumps" ], "/tmp" )
68
68
# new disk, no failing sectors
69
- set_smart_dump ("MCCOE64GEMPP--2.9.09" , "/dev/sda" )
69
+ self . set_smart_dump ("MCCOE64GEMPP--2.9.09" , "/dev/sda" )
70
70
71
71
self .login_and_go ("/storage" )
72
72
b .wait_visible (self .card ("Storage" ))
@@ -75,23 +75,23 @@ class TestStorageSmart(storagelib.StorageSmartCase):
75
75
check_smart_info ("Disk is OK" , "1 hours" , "Successful" )
76
76
77
77
# Disk with running self test
78
- set_smart_dump ("SAMSUNG_MMCQE28G8MUP--0VA_VAM08L1Q" , "/dev/sda" )
78
+ self . set_smart_dump ("SAMSUNG_MMCQE28G8MUP--0VA_VAM08L1Q" , "/dev/sda" )
79
79
check_smart_info ("Disk is OK" , "2417 hours" , "In progress, 30%" )
80
80
81
81
# Interrupted self test, disk is OK
82
- set_smart_dump ("INTEL_SSDSA2MH080G1GC--045C8820" , "/dev/sda" )
82
+ self . set_smart_dump ("INTEL_SSDSA2MH080G1GC--045C8820" , "/dev/sda" )
83
83
check_smart_info ("Disk is OK" , "2309 hours" , "Interrupted" )
84
84
85
85
# Aborted self test and has known bad sector
86
- set_smart_dump ("ST9160821AS--3.CLH" , "/dev/sda" )
86
+ self . set_smart_dump ("ST9160821AS--3.CLH" , "/dev/sda" )
87
87
check_smart_info ("Disk is failing" , "556 hours" , "Aborted" , bad_sectors = "1" )
88
88
89
89
# Multiple bad sectors
90
- set_smart_dump ("Maxtor_96147H8--BAC51KJ0" , "/dev/sda" )
90
+ self . set_smart_dump ("Maxtor_96147H8--BAC51KJ0" , "/dev/sda" )
91
91
check_smart_info ("Disk is failing" , "2016 hours" , "Successful" , bad_sectors = "71" )
92
92
93
93
# Multiple bad sectors with failing attribute
94
- set_smart_dump ("Maxtor_96147H8--BAC51KJ0--2" , "/dev/sda" )
94
+ self . set_smart_dump ("Maxtor_96147H8--BAC51KJ0--2" , "/dev/sda" )
95
95
check_smart_info ("Disk is failing" , "2262 hours" , "Successful" , bad_sectors = "71" , failing_attrs = "1" )
96
96
97
97
# Check that SMART card is not visible on DVD drive
@@ -100,6 +100,33 @@ class TestStorageSmart(storagelib.StorageSmartCase):
100
100
b .wait_visible (self .card ("Media drive" ))
101
101
b .wait_not_present (self .card ("Device health (SMART)" ))
102
102
103
+ def testSmartOverview (self ):
104
+ m = self .machine
105
+ b = self .browser
106
+
107
+ # udisks2 version > 2.10.1 is required to mock SMART data on virtual disks
108
+ if not self .udisks_mock_smart_supported ():
109
+ stderr .write ("Image has old udisks2 version, cannot run SMART test.\n " )
110
+ return
111
+
112
+ m .upload (["verify/files/smart-dumps" ], "/tmp" )
113
+ # Failing disk, storage page is not loaded
114
+ self .set_smart_dump ("Maxtor_96147H8--BAC51KJ0--2" , "/dev/sda" )
115
+ self .login_and_go ("/system" )
116
+ b .wait_in_text ("#smart-status" , "1 disk is failing" )
117
+
118
+ self .set_smart_dump ("MCCOE64GEMPP--2.9.09" , "/dev/sda" )
119
+ b .wait_not_present ("#smart-status" )
120
+
121
+ # Clicking the link navigates to storage page, failing disk has red icon
122
+ self .set_smart_dump ("Maxtor_96147H8--BAC51KJ0" , "/dev/sda" )
123
+ b .wait_in_text ("#smart-status" , "1 disk is failing" )
124
+ b .click ("#smart-status a" )
125
+ b .enter_page ("/storage" )
126
+ b .wait_visible (self .card ("Storage" ))
127
+ b .wait_visible (self .card_row ("Storage" , name = "sda" ))
128
+ b .wait_visible (self .card_row ("Storage" , name = "sda" ) + " .ct-icon-times-circle" )
129
+
103
130
104
131
if __name__ == '__main__' :
105
132
testlib .test_main ()
0 commit comments