Skip to content

Commit

Permalink
Remove fact memoization
Browse files Browse the repository at this point in the history
This already happens in rspec-puppet-facts itself and there's no reason
to duplicate it. There it's also more correct by taking all variables
into account.
  • Loading branch information
ekohl committed Jul 13, 2021
1 parent 8369408 commit add4a49
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions lib/voxpupuli/test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ def suggest_facter_version
require 'voxpupuli/test/facts'
require 'puppetlabs_spec_helper/module_spec_helper'

# Generating facts is slow - this memoizes the facts between multiple classes.
# Marshalling is used to get unique instances which helps when tests overrides
# facts.
FACTS_CACHE = {}
def on_supported_os(opts = {})
result = FACTS_CACHE[opts.to_s] ||= super(opts)
Marshal.load(Marshal.dump(result))
end

RSpec.configure do |config|
config.default_facter_version = suggest_facter_version

Expand Down
2 changes: 1 addition & 1 deletion voxpupuli-test.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'metadata-json-lint'
s.add_runtime_dependency 'parallel_tests'
s.add_runtime_dependency 'puppetlabs_spec_helper', '>= 2.14.0'
s.add_runtime_dependency 'rspec-puppet-facts', '>= 1.9.5'
s.add_runtime_dependency 'rspec-puppet-facts', '>= 2.0.1', '< 3'
s.add_runtime_dependency 'rspec-puppet-utils', '>= 1.9.5'

# Rubocop
Expand Down

0 comments on commit add4a49

Please sign in to comment.