@@ -168,18 +168,15 @@ def test_non_partuuid_boot(uvm_plain_any, io_engine):
168
168
169
169
test_microvm .start ()
170
170
171
- # Prepare the input for doing the assertion
172
- assert_dict = {}
173
- # Keep an array of strings specifying the location where some string
174
- # from the output is located.
175
- # 1-0 means line 1, column 0.
176
- keys_array = ["1-0" , "1-6" , "2-0" ]
177
171
# Keep a dictionary where the keys are the location and the values
178
172
# represent the input to assert against.
179
- assert_dict [keys_array [0 ]] = "ro"
180
- assert_dict [keys_array [1 ]] = "/dev/vda"
181
- assert_dict [keys_array [2 ]] = "ro"
182
- _check_drives (test_microvm , assert_dict , keys_array )
173
+ # 1, 0 means line 1, column 0.
174
+ assert_dict = {
175
+ (1 , 0 ): "ro" ,
176
+ (1 , 6 ): "/dev/vda" ,
177
+ (2 , 0 ): "ro" ,
178
+ }
179
+ _check_drives (test_microvm , assert_dict , assert_dict .keys ())
183
180
184
181
185
182
def test_partuuid_boot (uvm_plain_any , partuuid_and_disk_path_tmpfs , io_engine ):
@@ -207,13 +204,13 @@ def test_partuuid_boot(uvm_plain_any, partuuid_and_disk_path_tmpfs, io_engine):
207
204
)
208
205
test_microvm .start ()
209
206
210
- assert_dict = {}
211
- keys_array = [ "1-0" , "1-6" , "2-0" , "2-6" ]
212
- assert_dict [ keys_array [ 0 ]] = "rw"
213
- assert_dict [ keys_array [ 1 ]] = "/dev/vda"
214
- assert_dict [ keys_array [ 2 ]] = "rw"
215
- assert_dict [ keys_array [ 3 ]] = "/dev/vda1"
216
- _check_drives (test_microvm , assert_dict , keys_array )
207
+ assert_dict = {
208
+ ( 1 , 0 ): "rw" ,
209
+ ( 1 , 6 ): "/dev/vda" ,
210
+ ( 2 , 0 ): "rw" ,
211
+ ( 2 , 6 ): "/dev/vda1" ,
212
+ }
213
+ _check_drives (test_microvm , assert_dict , assert_dict . keys () )
217
214
218
215
219
216
def test_partuuid_update (uvm_plain_any , io_engine ):
@@ -247,11 +244,11 @@ def test_partuuid_update(uvm_plain_any, io_engine):
247
244
test_microvm .start ()
248
245
249
246
# Assert that the final booting method is from /dev/vda.
250
- assert_dict = {}
251
- keys_array = [ "1-0" , "1-6" ]
252
- assert_dict [ keys_array [ 0 ]] = "rw"
253
- assert_dict [ keys_array [ 1 ]] = "/dev/vda"
254
- _check_drives (test_microvm , assert_dict , keys_array )
247
+ assert_dict = {
248
+ ( 1 , 0 ): "rw" ,
249
+ ( 1 , 6 ): "/dev/vda" ,
250
+ }
251
+ _check_drives (test_microvm , assert_dict , assert_dict . keys () )
255
252
256
253
257
254
def test_patch_drive (uvm_plain_any , io_engine ):
@@ -370,11 +367,9 @@ def _check_file_size(ssh_connection, dev_path, size):
370
367
371
368
def _process_blockdev_output (blockdev_out , assert_dict , keys_array ):
372
369
blockdev_out_lines = blockdev_out .splitlines ()
373
- for key in keys_array :
374
- line = int (key .split ("-" )[0 ])
375
- col = int (key .split ("-" )[1 ])
370
+ for line , col in keys_array :
376
371
blockdev_out_line_cols = blockdev_out_lines [line ].split ()
377
- assert blockdev_out_line_cols [col ] == assert_dict [key ]
372
+ assert blockdev_out_line_cols [col ] == assert_dict [line , col ]
378
373
379
374
380
375
def _check_drives (test_microvm , assert_dict , keys_array ):
0 commit comments