mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Various checks in the start domain action were accidentally causing a redefine right after initial create. Update to provide debug output when the domain needs to be changed to allow capture of the redefines occurring in the future and to make it easy for the tests to pick up where the redefine was triggered by setting an expectation on the log output. Include a small fix to avoid running strip on what might be a nil object returned for elements without any text attributes. Fix a bug where changes to tpm settings made to the config after an initial domain creation where there was previously no tpm defined, would be ignored. Adds a logger double and updates other tests that trigger log calls. should fix #1176
39 lines
1.2 KiB
Ruby
39 lines
1.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
shared_context 'unit' do
|
|
include_context 'vagrant-unit'
|
|
|
|
let(:vagrantfile_providerconfig) { '' }
|
|
let(:vagrantfile) do
|
|
<<-EOF
|
|
Vagrant.configure('2') do |config|
|
|
config.vm.define :test
|
|
config.vm.provider :libvirt do |libvirt|
|
|
#{vagrantfile_providerconfig}
|
|
end
|
|
end
|
|
EOF
|
|
end
|
|
let(:test_env) do
|
|
test_env = isolated_environment
|
|
test_env.vagrantfile vagrantfile
|
|
test_env
|
|
end
|
|
let(:env) { { env: iso_env, machine: machine, ui: ui, root_path: '/rootpath' } }
|
|
let(:conf) { Vagrant::Config::V2::DummyConfig.new }
|
|
let(:ui) { Vagrant::UI::Silent.new }
|
|
let(:iso_env) { test_env.create_vagrant_env ui_class: Vagrant::UI::Basic }
|
|
let(:machine) { iso_env.machine(:test, :libvirt) }
|
|
# Mock the communicator to prevent SSH commands for being executed.
|
|
let(:communicator) { double('communicator') }
|
|
# Mock the guest operating system.
|
|
let(:guest) { double('guest') }
|
|
let(:app) { ->(env) {} }
|
|
let(:plugin) { register_plugin }
|
|
|
|
before (:each) do
|
|
allow(machine).to receive(:guest).and_return(guest)
|
|
allow(machine).to receive(:communicator).and_return(communicator)
|
|
end
|
|
end
|