Skip to content

Commit

Permalink
Fixes #38017 - Update libvirt gems & fix tests
Browse files Browse the repository at this point in the history
Gems:
* Use fog-libvirt 0.13.0
* Use ruby-libvirt 0.8.3

Tests:
* Use "test:///default" for testing
* Fix failing tests
  • Loading branch information
stejskalleos committed Nov 19, 2024
1 parent a525369 commit 9f94665
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bundler.d/libvirt.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group :libvirt do
gem 'fog-libvirt', '>= 0.12.0'
gem 'ruby-libvirt', '~> 0.5', :require => 'libvirt'
gem 'fog-libvirt', '~> 0.13.0'
gem 'ruby-libvirt', '>= 0.8.3', :require => 'libvirt'
end
4 changes: 4 additions & 0 deletions test/factories/compute_resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

trait :libvirt do
provider { 'Libvirt' }
# url { 'test:///default' } prevents the error:
# Call to virConnectOpen failed: Cannot read CA certificate
# '/etc/pki/CA/cacert.pem': No such file or directory
url { 'test:///default' }
end

trait :openstack do
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/compute_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
one:
name: bigcompute
description: MyString
url: qemu://stam/system
url: test:///default
user: MyString
password: encrypted-NEN1YVJtdWdaaTdlOHdiUXRHd29nWUZsOHc1UjdMb3p1MFZLenlLekFEbz0tLVA0MGVzUEorUDlJZHVUV2F6azUzUEE9PQ==--9f45d5c88ec582eeb48ebb906ae0a66345ded0fa
uuid: MyString
Expand All @@ -11,7 +11,7 @@ one:
mycompute:
name: mycompute
description: mycompute
url: test:///default # test hypervisor URI needed to try listing vms
url: test:///default # test hypervisor URI needed to try listing vms
user: MyString
password: encrypted-QU5oNkZVSkRRTW81U2hSemhqcU1mdFpYM0FXUEpVZndseWl2NERvS0laWT0tLWpsU295K0kxcWNLT2g1WTRrcC9TVXc9PQ==--5936541f0bda1b2262bb610340facf3c3880bdd0
uuid: mycompute
Expand Down
6 changes: 3 additions & 3 deletions test/unit/compute_resource_host_importer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ class ComputeResourceHostImporterTest < ActiveSupport::TestCase

context 'on libvirt' do
let(:compute_resource) { FactoryBot.build(:libvirt_cr) }
let(:uuid) { 'fog-449765558356062' }
let(:uuid) { '6695eb01-f6a4-8304-79aa-97f2502e193f' }

test 'imports the VM with all parameters' do
assert_equal 'fog-dom1', host.name
assert_equal 'dom.uuid', host.uuid
assert_equal 'test', host.name
assert_equal uuid, host.uuid
assert_nil host.domain
assert_equal 'aa:bb:cc:dd:ee:ff', host.mac
assert_empty host.primary_interface.compute_attributes
Expand Down

0 comments on commit 9f94665

Please sign in to comment.