1616from api .cas .cache_config import CacheMode
1717from api .cas .ioclass_config import IoClass
1818from core .test_run import TestRun
19- from test_tools .fs_tools import Filesystem , create_directory , check_if_directory_exists , \
20- read_file , crc32sum
19+ from test_tools .fs_tools import (
20+ Filesystem ,
21+ create_directory ,
22+ check_if_directory_exists ,
23+ read_file ,
24+ crc32sum ,
25+ )
2126from test_tools .fio .fio import Fio
2227from test_tools .fio .fio_param import ReadWrite , IoEngine , VerifyMethod
2328from storage_devices .disk import DiskType , DiskTypeSet , DiskTypeLowerThan
@@ -53,11 +58,13 @@ def test_data_integrity_5d_with_io_classification(filesystems):
5358 runtime = datetime .timedelta (days = 5 )
5459
5560 with TestRun .step ("Prepare cache and core devices" ):
56- cache_device = TestRun .disks ['cache' ]
57- core_devices = [TestRun .disks ['core1' ],
58- TestRun .disks ['core2' ],
59- TestRun .disks ['core3' ],
60- TestRun .disks ['core4' ]]
61+ cache_device = TestRun .disks ["cache" ]
62+ core_devices = [
63+ TestRun .disks ["core1" ],
64+ TestRun .disks ["core2" ],
65+ TestRun .disks ["core3" ],
66+ TestRun .disks ["core4" ],
67+ ]
6168
6269 cache_device .create_partitions ([Size (50 , Unit .GibiByte )] * len (core_devices ))
6370
@@ -76,8 +83,7 @@ def test_data_integrity_5d_with_io_classification(filesystems):
7683
7784 with TestRun .step ("Add one core to each cache" ):
7885 cores = [
79- cache .add_core (core_dev = core_part )
80- for cache , core_part in zip (caches , core_partitions )
86+ cache .add_core (core_dev = core_part ) for cache , core_part in zip (caches , core_partitions )
8187 ]
8288
8389 with TestRun .step ("Load default I/O class config for each cache" ):
@@ -90,7 +96,7 @@ def test_data_integrity_5d_with_io_classification(filesystems):
9096
9197 with TestRun .step ("Mount cached volumes" ):
9298 for core in cores :
93- mount_point = core .path .replace (' /dev/' , ' /mnt/' )
99+ mount_point = core .path .replace (" /dev/" , " /mnt/" )
94100 if not check_if_directory_exists (mount_point ):
95101 create_directory (mount_point )
96102 core .mount (mount_point )
@@ -99,32 +105,31 @@ def test_data_integrity_5d_with_io_classification(filesystems):
99105 with TestRun .step ("Prepare fio workload config" ):
100106 template_io_classes = IoClass .csv_to_list (read_file (template_config_path ))
101107 config_max_file_sizes = [
102- int (re .search (r'\d+' , io_class .rule ).group ())
103- for io_class in template_io_classes if io_class .rule .startswith ("file_size:le" )
108+ int (re .search (r"\d+" , io_class .rule ).group ())
109+ for io_class in template_io_classes
110+ if io_class .rule .startswith ("file_size:le" )
104111 ]
105112 config_max_file_sizes .append (config_max_file_sizes [- 1 ] * 2 )
106113 io_class_section_size = Size (
107- int (core_size .get_value (Unit .GibiByte ) / len (config_max_file_sizes )),
108- Unit .GibiByte
109- )
110-
111- fio = Fio ()
112- fio_run = fio .create_command ()
113- fio .base_cmd_parameters .set_param (
114- 'alloc-size' , int (Size (1 , Unit .GiB ).get_value (Unit .KiB ))
114+ int (core_size .get_value (Unit .GibiByte ) / len (config_max_file_sizes )), Unit .GibiByte
115115 )
116116
117- fio_run .io_engine (IoEngine .libaio )
118- fio_run .direct ()
119- fio_run .time_based ()
120- fio_run .do_verify ()
121- fio_run .verify (VerifyMethod .md5 )
122- fio_run .verify_dump ()
123- fio_run .run_time (runtime )
124- fio_run .read_write (ReadWrite .randrw )
125- fio_run .io_depth (128 )
126- fio_run .blocksize_range (
127- [(Size (512 , Unit .Byte ).get_value (), Size (128 , Unit .KibiByte ).get_value ())]
117+ fio_run = (
118+ Fio ()
119+ .create_command (alloc_size = Size (1 , Unit .GibiByte ))
120+ .io_engine (IoEngine .libaio )
121+ .direct ()
122+ .time_based ()
123+ .do_verify ()
124+ .verify (VerifyMethod .md5 )
125+ .verify_dump ()
126+ .run_time (runtime )
127+ .read_write (ReadWrite .randrw )
128+ .open_files (1000 )
129+ .io_depth (128 )
130+ .blocksize_range (
131+ [(Size (512 , Unit .Byte ).get_value (), Size (128 , Unit .KibiByte ).get_value ())]
132+ )
128133 )
129134
130135 for core in cores :
@@ -157,12 +162,14 @@ def test_data_integrity_5d_with_io_classification(filesystems):
157162 dev_crc32s = [crc32sum (dev .path , timeout = timedelta (hours = 4 )) for dev in core_devices ]
158163
159164 with TestRun .step ("Compare crc32 sums for cores and core devices" ):
160- for core_crc32 , dev_crc32 , mode , fs in zip (
161- core_crc32s , dev_crc32s , cache_modes , filesystems
165+ for core_crc32 , dev_crc32 , cache_mode , filesystem in zip (
166+ core_crc32s , dev_crc32s , cache_modes , filesystems
162167 ):
163168 if core_crc32 != dev_crc32 :
164- TestRun .fail ("Crc32 sums of core and core device do not match! "
165- f"Cache mode: { mode } Filesystem: { fs } " )
169+ TestRun .fail (
170+ "Crc32 sums of core and core device do not match!\n "
171+ f"Cache mode: { cache_mode } Filesystem: { filesystem } "
172+ )
166173
167174
168175@pytest .mark .os_dependent
@@ -186,11 +193,13 @@ def test_data_integrity_5d():
186193 runtime = datetime .timedelta (days = 5 )
187194
188195 with TestRun .step ("Prepare cache and core devices" ):
189- cache_device = TestRun .disks ['cache' ]
190- core_devices = [TestRun .disks ['core1' ],
191- TestRun .disks ['core2' ],
192- TestRun .disks ['core3' ],
193- TestRun .disks ['core4' ]]
196+ cache_device = TestRun .disks ["cache" ]
197+ core_devices = [
198+ TestRun .disks ["core1" ],
199+ TestRun .disks ["core2" ],
200+ TestRun .disks ["core3" ],
201+ TestRun .disks ["core4" ],
202+ ]
194203
195204 cache_device .create_partitions ([Size (50 , Unit .GibiByte )] * len (core_devices ))
196205
@@ -213,19 +222,23 @@ def test_data_integrity_5d():
213222 ]
214223
215224 with TestRun .step ("Prepare fio workload config" ):
216- fio_run = Fio ().create_command ()
217- fio_run .io_engine (IoEngine .libaio )
218- fio_run .direct ()
219- fio_run .time_based ()
220- fio_run .do_verify ()
221- fio_run .verify (VerifyMethod .md5 )
222- fio_run .verify_dump ()
223- fio_run .run_time (runtime )
224- fio_run .read_write (ReadWrite .randrw )
225- fio_run .io_depth (128 )
226- fio_run .blocksize_range (
227- [(Size (512 , Unit .Byte ).get_value (), Size (128 , Unit .KibiByte ).get_value ())]
225+ fio_run = (
226+ Fio ()
227+ .create_command ()
228+ .io_engine (IoEngine .pvsync )
229+ .direct ()
230+ .time_based ()
231+ .do_verify ()
232+ .verify (VerifyMethod .md5 )
233+ .verify_dump ()
234+ .run_time (runtime )
235+ .read_write (ReadWrite .randrw )
236+ .io_depth (128 )
237+ .blocksize_range (
238+ [(Size (512 , Unit .Byte ).get_value (), Size (128 , Unit .KibiByte ).get_value ())]
239+ )
228240 )
241+
229242 for core in cores :
230243 fio_job = fio_run .add_job ()
231244 fio_job .target (core )
@@ -244,7 +257,9 @@ def test_data_integrity_5d():
244257 dev_crc32s = [crc32sum (dev .path , timeout = timedelta (hours = 4 )) for dev in core_devices ]
245258
246259 with TestRun .step ("Compare crc32 sums for cores and core devices" ):
247- for core_crc32 , dev_crc32 , mode in zip (core_crc32s , dev_crc32s , cache_modes ):
260+ for core_crc32 , dev_crc32 , cache_mode in zip (core_crc32s , dev_crc32s , cache_modes ):
248261 if core_crc32 != dev_crc32 :
249- TestRun .fail ("Crc32 sums of core and core device do not match! "
250- f"Cache mode: { mode } " )
262+ TestRun .fail (
263+ "Crc32 sums of core and core device do not match!\n "
264+ f"Cache mode with wrong crc32 sum: { cache_mode } "
265+ )
0 commit comments