Skip to content

Commit

Permalink
Add missing probe test
Browse files Browse the repository at this point in the history
Note, Ovirt namespace exists in the client gem and also in the
ManageIQ::Providers namespace so we need to clarify which Ovirt we want,
namely, the ovirt gem's one.

We had a regression and tests didn't detect it:
ManageIQ#208
ManageIQ/manageiq#16994
  • Loading branch information
jrafanie committed Feb 15, 2018
1 parent 3fe54f7 commit 061f01b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/manageiq/providers/redhat/discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module Providers
module Redhat
class Discovery
def self.probe(ost)
Ovirt.logger = $rhevm_log if $rhevm_log
::Ovirt.logger = $rhevm_log if $rhevm_log

if ManageIQ::NetworkDiscovery::Port.open?(ost, Ovirt::Service::DEFAULT_PORT) &&
Ovirt::Service.ovirt?(:server => ost.ipaddr, :verify_ssl => false)
if ManageIQ::NetworkDiscovery::Port.open?(ost, ::Ovirt::Service::DEFAULT_PORT) &&
::Ovirt::Service.ovirt?(:server => ost.ipaddr, :verify_ssl => false)
ost.hypervisor << :rhevm
end
end
Expand Down
10 changes: 10 additions & 0 deletions spec/models/manageiq/providers/redhat/discovery_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe ManageIQ::Providers::Redhat::Discovery do
it ".probe" do
require 'ostruct'
allow(ManageIQ::NetworkDiscovery::Port).to receive(:open?).and_return(true)
allow(::Ovirt::Service).to receive(:ovirt?).and_return(true)
ost = OpenStruct.new(:ipaddr => "172.168.0.1", :hypervisor => [])
described_class.probe(ost)
expect(ost.hypervisor).to eq [:rhevm]
end
end

0 comments on commit 061f01b

Please sign in to comment.