@@ -406,6 +406,8 @@ def test_no_configdrive_partition(self, mock_configdrive, mock_unlink):
406
406
cpu_arch = "" )
407
407
mock_unlink .assert_called_once_with ('fake-path' )
408
408
409
+ @mock .patch .object (disk_utils , 'trigger_device_rescan' ,
410
+ lambda d : None )
409
411
@mock .patch .object (utils , 'mkfs' , lambda fs , path , label = None : None )
410
412
@mock .patch .object (disk_utils , 'block_uuid' , lambda p : 'uuid' )
411
413
@mock .patch .object (disk_utils , 'populate_image' , autospec = True )
@@ -440,6 +442,8 @@ def test_without_image(self, mock_populate):
440
442
self .assertEqual ('uuid' , res ['root uuid' ])
441
443
self .assertFalse (mock_populate .called )
442
444
445
+ @mock .patch .object (disk_utils , 'trigger_device_rescan' ,
446
+ lambda d : None )
443
447
@mock .patch .object (utils , 'mkfs' , lambda fs , path , label = None : None )
444
448
@mock .patch .object (disk_utils , 'block_uuid' , lambda p : 'uuid' )
445
449
@mock .patch .object (disk_utils , 'populate_image' , lambda image_path ,
@@ -473,11 +477,12 @@ def test_gpt_disk_label(self):
473
477
disk_label = 'gpt' ,
474
478
cpu_arch = "" )
475
479
480
+ @mock .patch .object (disk_utils , 'trigger_device_rescan' , autospec = True )
476
481
@mock .patch .object (disk_utils , 'block_uuid' , autospec = True )
477
482
@mock .patch .object (disk_utils , 'populate_image' , autospec = True )
478
483
@mock .patch .object (utils , 'mkfs' , autospec = True )
479
484
def test_uefi_localboot (self , mock_mkfs , mock_populate_image ,
480
- mock_block_uuid ):
485
+ mock_block_uuid , mock_trigger_device_rescan ):
481
486
"""Test that we create a fat filesystem with UEFI localboot."""
482
487
root_part = '/dev/fake-part1'
483
488
efi_part = '/dev/fake-part2'
@@ -508,12 +513,14 @@ def test_uefi_localboot(self, mock_mkfs, mock_populate_image,
508
513
root_part , conv_flags = None )
509
514
mock_block_uuid .assert_any_call (root_part )
510
515
mock_block_uuid .assert_any_call (efi_part )
516
+ mock_trigger_device_rescan .assert_called_once_with (self .dev )
511
517
518
+ @mock .patch .object (disk_utils , 'trigger_device_rescan' , autospec = True )
512
519
@mock .patch .object (disk_utils , 'block_uuid' , autospec = True )
513
520
@mock .patch .object (disk_utils , 'populate_image' , autospec = True )
514
521
@mock .patch .object (utils , 'mkfs' , autospec = True )
515
522
def test_preserve_ephemeral (self , mock_mkfs , mock_populate_image ,
516
- mock_block_uuid ):
523
+ mock_block_uuid , mock_trigger_device_rescan ):
517
524
"""Test that ephemeral partition doesn't get overwritten."""
518
525
ephemeral_part = '/dev/fake-part1'
519
526
root_part = '/dev/fake-part2'
@@ -541,11 +548,12 @@ def test_preserve_ephemeral(self, mock_mkfs, mock_populate_image,
541
548
cpu_arch = "" )
542
549
self .assertFalse (mock_mkfs .called )
543
550
551
+ @mock .patch .object (disk_utils , 'trigger_device_rescan' , autospec = True )
544
552
@mock .patch .object (disk_utils , 'block_uuid' , autospec = True )
545
553
@mock .patch .object (disk_utils , 'populate_image' , autospec = True )
546
554
@mock .patch .object (utils , 'mkfs' , autospec = True )
547
555
def test_ppc64le_prep_part (self , mock_mkfs , mock_populate_image ,
548
- mock_block_uuid ):
556
+ mock_block_uuid , mock_trigger_device_rescan ):
549
557
"""Test that PReP partition uuid is returned."""
550
558
prep_part = '/dev/fake-part1'
551
559
root_part = '/dev/fake-part2'
@@ -571,11 +579,12 @@ def test_ppc64le_prep_part(self, mock_mkfs, mock_populate_image,
571
579
cpu_arch = "ppc64le" )
572
580
self .assertFalse (mock_mkfs .called )
573
581
582
+ @mock .patch .object (disk_utils , 'trigger_device_rescan' , autospec = True )
574
583
@mock .patch .object (disk_utils , 'block_uuid' , autospec = True )
575
584
@mock .patch .object (disk_utils , 'populate_image' , autospec = True )
576
585
@mock .patch .object (utils , 'mkfs' , autospec = True )
577
586
def test_convert_to_sparse (self , mock_mkfs , mock_populate_image ,
578
- mock_block_uuid ):
587
+ mock_block_uuid , mock_trigger_device_rescan ):
579
588
ephemeral_part = '/dev/fake-part1'
580
589
swap_part = '/dev/fake-part2'
581
590
root_part = '/dev/fake-part3'
0 commit comments