Reduce start domain unnecessary domain redefines (#1178)

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
This commit is contained in:
Darragh Bailey
2020-12-05 15:24:42 +00:00
committed by GitHub
parent c12b0de254
commit 21f7a796ff
8 changed files with 130 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ shared_context 'libvirt' do
let(:id) { 'dummy-vagrant_dummy' }
let(:connection) { double('connection') }
let(:domain) { double('domain') }
let(:logger) { double('logger') }
def connection_result(options = {})
result = options.fetch(:result, nil)
@@ -26,5 +27,6 @@ shared_context 'libvirt' do
allow(domain).to receive(:mac).and_return('9C:D5:53:F1:5A:E7')
allow(machine).to receive(:id).and_return(id)
allow(Log4r::Logger).to receive(:new).and_return(logger)
end
end