mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Handle nil volumes when cd-rom attached (#1273)
When a cd-rom is attached as an additional storage, listing the volumes can include a nil element. Make sure to check that the element is valid before attempting to access the attribute. Update the test to better match the observed behaviour. Fixes: #1209, #1262
This commit is contained in:
@@ -85,7 +85,7 @@ describe VagrantPlugins::ProviderLibvirt::Action::DestroyDomain do
|
||||
|
||||
it 'uses explicit removal of disks' do
|
||||
allow(libvirt_domain).to receive(:name).and_return('test')
|
||||
allow(domain).to receive(:volumes).and_return([root_disk])
|
||||
allow(domain).to receive(:volumes).and_return([root_disk, nil])
|
||||
|
||||
expect(domain).to_not receive(:destroy).with(destroy_volumes: true)
|
||||
expect(root_disk).to receive(:destroy) # root disk remove
|
||||
|
||||
Reference in New Issue
Block a user