Skip to content

Commit

Permalink
Add spec for bhyve
Browse files Browse the repository at this point in the history
Thanks to twitter I was able to get dmidecode output from a bhyve guest
  • Loading branch information
tas50 committed Apr 22, 2016
1 parent a9173ac commit 68f1fea
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/unit/plugins/linux/virtualization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,25 @@
expect(plugin[:virtualization][:systems][:kvm]).to eq("guest")
end

it "sets bhyve guest if dmidecode detects bhyve" do
bhyve_dmidecode = <<-OUTPUT
System Information
Manufacturer:
Product Name: BHYVE
Version: 1.0
Serial Number: None
UUID: 023B323A-E139-4B36-8BC5-CEBB2469DAAA
Wake-up Type: Power Switch
SKU Number: None
Family:
OUTPUT
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, bhyve_dmidecode, ""))
plugin.run
expect(plugin[:virtualization][:system]).to eq("bhyve")
expect(plugin[:virtualization][:role]).to eq("guest")
expect(plugin[:virtualization][:systems][:bhyve]).to eq("guest")
end

it "should run dmidecode and not set virtualization if nothing is detected" do
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, "", ""))
plugin.run
Expand Down

0 comments on commit 68f1fea

Please sign in to comment.