Skip to content

Commit

Permalink
Merge pull request #674 from agrare/fix_ovirt_vm_smartstate_supports_…
Browse files Browse the repository at this point in the history
…typo

Fix typo in Ovirt VM supports?(:smartstate_analysis)
  • Loading branch information
Fryguy authored Aug 6, 2024
2 parents 7669eaa + e471feb commit 27666ab
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module ManageIQ::Providers::Ovirt::InfraManager::VmOrTemplateShared::Scanning
elsif !storage.storage_type_supported_for_ssa?
"Smartstate Analysis unsupported for storage type %{store_type}" % {:store_type => storage.store_type}
else
unuspported_reason(:action)
unsupported_reason(:action)
end
end
end
Expand Down
35 changes: 35 additions & 0 deletions spec/models/manageiq/providers/ovirt/infra_manager/vm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,41 @@
end
end

describe "supports?(:smartstate_analysis)" do
let(:vm) { FactoryBot.create(:vm_ovirt, :ext_management_system => ems, :host => host, :storage => storage) }

context "without a storage" do
let(:storage) { nil }

it "returns false" do
expect(vm.supports?(:smartstate_analysis)).to be_falsey
expect(vm.unsupported_reason(:smartstate_analysis)).to eq("Vm is not located on a storage")
end
end

context "with a storage" do
let(:storage) { FactoryBot.create(:storage_ovirt, :store_type => store_type) }

context "with a supported store_type" do
let(:store_type) { "NFS" }

it "returns false" do
expect(vm.supports?(:smartstate_analysis)).to be_truthy
expect(vm.unsupported_reason(:smartstate_analysis)).to be_nil
end
end

context "with an unsupported store_type" do
let(:store_type) { "BAD-STORE-TYPE" }

it "returns false" do
expect(vm.supports?(:smartstate_analysis)).to be_falsey
expect(vm.unsupported_reason(:smartstate_analysis)).to eq("Smartstate Analysis unsupported for storage type BAD-STORE-TYPE")
end
end
end
end

context "#calculate_power_state" do
it "returns suspended when suspended" do
expect(described_class.calculate_power_state('suspended')).to eq('suspended')
Expand Down

0 comments on commit 27666ab

Please sign in to comment.