summaryrefslogtreecommitdiff
path: root/spec/functional/resource/base.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2014-07-29 15:51:14 -0700
committerdanielsdeleo <dan@getchef.com>2014-07-30 14:07:07 -0700
commitfc3b0eed9b8b33bcb51121deee09314f9eb86622 (patch)
tree8be687de08267fcf996de1d949812808434fa967 /spec/functional/resource/base.rb
parente2423a426a79196f327feea16ada95f88d2df9fb (diff)
downloadchef-fc3b0eed9b8b33bcb51121deee09314f9eb86622.tar.gz
Move `ohai` helper into platform_helpers, fix perf issue.
The ohai method is more relevant to platform detection in tests, so it is moved into platform_helpers. It is also modified to use the `OHAI_SYSTEM` constant we set in spec_helper. The prior implementation did not correctly memoize the method, which resulted in several hundred invocations of the ohai platform plugin during test loading, which took ~70s on my machine (before any tests ran).
Diffstat (limited to 'spec/functional/resource/base.rb')
-rw-r--r--spec/functional/resource/base.rb10
1 files changed, 0 insertions, 10 deletions
diff --git a/spec/functional/resource/base.rb b/spec/functional/resource/base.rb
index 056db39877..cdb52fbc1b 100644
--- a/spec/functional/resource/base.rb
+++ b/spec/functional/resource/base.rb
@@ -16,16 +16,6 @@
# limitations under the License.
#
-require 'spec_helper'
-
-def ohai
- # provider is platform-dependent, we need platform ohai data:
- @OHAI_SYSTEM ||= begin
- ohai = Ohai::System.new
- ohai.all_plugins("platform")
- ohai
- end
-end
def run_context
@run_context ||= begin