summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalim Alam <salam@chef.io>2016-02-01 14:23:44 -0800
committerSalim Alam <salam@chef.io>2016-02-01 14:23:44 -0800
commitd0c87af5266c138549c99fc3435ae0a85f02fb6a (patch)
tree1463d096c8d0e55aad87971857bad1f62d0ac8f3
parent1a0d94db2974d42f047d20dc7928893696d0bf1f (diff)
downloadchef-salam/ohai-spec-speedup.tar.gz
Use minimal Ohai for testssalam/ohai-spec-speedup
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb5
-rw-r--r--spec/functional/dsl/registry_helper_spec.rb5
-rw-r--r--spec/functional/resource/ohai_spec.rb7
-rw-r--r--spec/functional/resource/registry_spec.rb10
-rw-r--r--spec/functional/win32/registry_spec.rb5
-rw-r--r--spec/unit/dsl/regsitry_helper_spec.rb6
-rw-r--r--spec/unit/provider/ohai_spec.rb5
7 files changed, 33 insertions, 10 deletions
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index 966f8b58c5..128d373d35 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -24,7 +24,10 @@ describe Chef::DSL::RebootPending, :windows_only do
def run_ohai
ohai = Ohai::System.new
# Would be nice to limit this to platform/kernel/arch etc for Ohai 7
- ohai.all_plugins
+
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ ohai.all_plugins(filter)
+
node.consume_external_attrs(ohai.data,{})
ohai
diff --git a/spec/functional/dsl/registry_helper_spec.rb b/spec/functional/dsl/registry_helper_spec.rb
index 20efade913..47f5151888 100644
--- a/spec/functional/dsl/registry_helper_spec.rb
+++ b/spec/functional/dsl/registry_helper_spec.rb
@@ -31,8 +31,11 @@ describe Chef::Resource::RegistryKey, :windows_only do
events = Chef::EventDispatch::Dispatcher.new
node = Chef::Node.new
+
ohai = Ohai::System.new
- ohai.all_plugins
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ ohai.all_plugins(filter)
+
node.consume_external_attrs(ohai.data,{})
run_context = Chef::RunContext.new(node, {}, events)
@resource = Chef::Resource.new("foo", run_context)
diff --git a/spec/functional/resource/ohai_spec.rb b/spec/functional/resource/ohai_spec.rb
index 8b93f22613..d27233baaa 100644
--- a/spec/functional/resource/ohai_spec.rb
+++ b/spec/functional/resource/ohai_spec.rb
@@ -19,9 +19,12 @@
require "spec_helper"
describe Chef::Resource::Ohai do
- let(:ohai) {
+ let!(:ohai) {
o = Ohai::System.new
- o.all_plugins
+
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ o.all_plugins(filter)
+
o
}
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index ec54e8253a..4b10a2a947 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -25,8 +25,11 @@ describe Chef::Resource::RegistryKey, :unix_only do
before(:all) do
events = Chef::EventDispatch::Dispatcher.new
node = Chef::Node.new
+
ohai = Ohai::System.new
- ohai.all_plugins
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ ohai.all_plugins(filter)
+
node.consume_external_attrs(ohai.data,{})
run_context = Chef::RunContext.new(node, {}, events)
@resource = Chef::Resource::RegistryKey.new("HKCU\\Software", run_context)
@@ -96,8 +99,11 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
before(:all) do
@events = Chef::EventDispatch::Dispatcher.new
@node = Chef::Node.new
+
ohai = Ohai::System.new
- ohai.all_plugins
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ ohai.all_plugins(filter)
+
@node.consume_external_attrs(ohai.data,{})
@run_context = Chef::RunContext.new(@node, {}, @events)
diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb
index 4e18074271..d68e2e8f3a 100644
--- a/spec/functional/win32/registry_spec.rb
+++ b/spec/functional/win32/registry_spec.rb
@@ -41,8 +41,11 @@ describe "Chef::Win32::Registry", :windows_only do
#Create the node with ohai data
events = Chef::EventDispatch::Dispatcher.new
@node = Chef::Node.new
+
ohai = Ohai::System.new
- ohai.all_plugins
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ ohai.all_plugins(filter)
+
@node.consume_external_attrs(ohai.data,{})
@run_context = Chef::RunContext.new(@node, {}, events)
diff --git a/spec/unit/dsl/regsitry_helper_spec.rb b/spec/unit/dsl/regsitry_helper_spec.rb
index 8647b79020..69f782adc9 100644
--- a/spec/unit/dsl/regsitry_helper_spec.rb
+++ b/spec/unit/dsl/regsitry_helper_spec.rb
@@ -24,8 +24,11 @@ describe Chef::Resource::RegistryKey do
before (:all) do
events = Chef::EventDispatch::Dispatcher.new
node = Chef::Node.new
+
ohai = Ohai::System.new
- ohai.all_plugins
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ ohai.all_plugins(filter)
+
node.consume_external_attrs(ohai.data,{})
run_context = Chef::RunContext.new(node, {}, events)
@resource = Chef::Resource::new("foo", run_context)
@@ -52,4 +55,3 @@ describe Chef::Resource::RegistryKey do
end
end
end
-
diff --git a/spec/unit/provider/ohai_spec.rb b/spec/unit/provider/ohai_spec.rb
index b5ce1e8fc5..ef8185752d 100644
--- a/spec/unit/provider/ohai_spec.rb
+++ b/spec/unit/provider/ohai_spec.rb
@@ -54,8 +54,11 @@ describe Chef::Provider::Ohai do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@new_resource = Chef::Resource::Ohai.new("ohai_reload")
+
ohai = Ohai::System.new
- ohai.all_plugins
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
+ ohai.all_plugins(filter)
+
@node.consume_external_attrs(ohai.data,{})
@provider = Chef::Provider::Ohai.new(@new_resource, @run_context)