diff options
author | Tim Smith <tsmith84@gmail.com> | 2016-05-09 16:49:26 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2016-05-09 17:20:57 -0700 |
commit | b18d70fc9011eb4efe83da1ccea4cd1e300df3a3 (patch) | |
tree | 09ec4ea33d90aaa58b2f9d46cf78947d479da06d /spec/unit | |
parent | be8c7a92395d45d1ed3ff6748d75da1c43b644e7 (diff) | |
download | ohai-b18d70fc9011eb4efe83da1ccea4cd1e300df3a3.tar.gz |
Detect Dreamhost DreamCompute
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/plugins/openstack_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/unit/plugins/openstack_spec.rb b/spec/unit/plugins/openstack_spec.rb index 7e11e27e..9b8397fb 100644 --- a/spec/unit/plugins/openstack_spec.rb +++ b/spec/unit/plugins/openstack_spec.rb @@ -45,7 +45,7 @@ describe "OpenStack Plugin" do plugin.run end - it "sets openstack provider attribute if the hint is provided" do + it "sets openstack attribute" do expect(plugin[:openstack][:provider]).to eq("openstack") end @@ -55,6 +55,18 @@ describe "OpenStack Plugin" do end end + context "when running on dreamhost" do + it "sets openstack provider attribute to dreamhost" do + plugin["etc"] = { "passwd" => { "dhc-user" => {} } } + allow(plugin).to receive(:can_metadata_connect?). + with(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80). + and_return(false) + plugin[:dmi] = { :system => { :all_records => [ { :Manufacturer => "OpenStack Foundation" } ] } } + plugin.run + expect(plugin[:openstack][:provider]).to eq("dreamhost") + end + end + context "when the hint is present" do context "and the metadata service is not available" do before do @@ -248,9 +260,6 @@ EOM it "sets the provider to openstack" do expect(plugin["openstack"]["provider"]).to eq("openstack") end - it "sets the provider to openstack" do - expect(plugin["openstack"]["provider"]).to eq("openstack") - end end end end |