Re: [virt-manager][PATCH 2/3] virt-convert: Don't detect existing paths in test suite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/15/2016 02:27 AM, Michal Privoznik wrote:
> We have this option --dry-run that should run through the
> installation process but don't actually touch anything. Just
> pretend the installation. And we have a test that uses it
> heavily. However, the test is failing:
> 
>   Traceback (most recent call last):
>     File "/home/zippy/work/virt-manager.git/tests/clitest.py", line 161, in _launch_command
>       ret = virtconvert.main(conn=conn)
>     File "virt-convert", line 111, in main
>       destdir=options.destination, dry=options.dry)
>     File "/home/zippy/work/virt-manager.git/virtconv/formats.py", line 314, in convert_disks
>       newpath)
>   RuntimeError: New path name '/var/lib/libvirt/images/fedora.qcow2' already exists
> 
> Problem is, even in test suite we really touch the host paths.
> This in general will spit unpredictable results. Resolution
> consists of making this specific part of the code fault tolerant
> if ran under test suite.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  virtconv/formats.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virtconv/formats.py b/virtconv/formats.py
> index ed8a66e..a7f88cb 100644
> --- a/virtconv/formats.py
> +++ b/virtconv/formats.py
> @@ -309,7 +309,7 @@ class VirtConverter(object):
>              if disk_format:
>                  newpath += ("." + disk_format)
>              newpath = os.path.join(destdir, newpath)
> -            if os.path.exists(newpath):
> +            if os.path.exists(newpath) and not _is_test():
>                  raise RuntimeError(_("New path name '%s' already exists") %
>                      newpath)
>  
> 

Thanks, pushed

- Cole

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux