From: BogdanIrimie Date: Mon, 14 Sep 2020 13:58:52 +0000 (+0300) Subject: (IAC-1143) Run Facter.clear before each test. X-Git-Tag: v7.6.0~1^2~2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=351b481a2cc78e53dd9fc0ccdfc30dad53f0dda1;p=puppet-modules%2Fpuppetlabs-apt.git (IAC-1143) Run Facter.clear before each test. --- diff --git a/Gemfile b/Gemfile index 902e049..c65a5be 100644 --- a/Gemfile +++ b/Gemfile @@ -34,18 +34,18 @@ group :development do gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0' end -puppet_version = ENV['PUPPET_GEM_VERSION'] -facter_version = ENV['FACTER_GEM_VERSION'] +# puppet_version = ENV['PUPPET_GEM_VERSION'] +# facter_version = ENV['FACTER_GEM_VERSION'] hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} -gems['puppet'] = location_for(puppet_version) +# gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment # variables -gems['facter'] = location_for(facter_version) if facter_version +# gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} @@ -68,6 +68,12 @@ extra_gemfiles = [ File.join(Dir.home, '.gemfile'), ] +gem 'facter', path:"/Users/bogdan.irimie/projects/facter" +gem 'puppet', path:"/Users/bogdan.irimie/projects/puppet" +# gem 'facter' +gem 'pry-byebug' + + extra_gemfiles.each do |gemfile| if File.file?(gemfile) && File.readable?(gemfile) eval(File.read(gemfile), binding) diff --git a/spec/unit/facter/apt_dist_has_updates_spec.rb b/spec/unit/facter/apt_dist_has_updates_spec.rb index 216050d..6130f27 100644 --- a/spec/unit/facter/apt_dist_has_updates_spec.rb +++ b/spec/unit/facter/apt_dist_has_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_has_dist_updates fact' do subject { Facter.fact(:apt_has_dist_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'on non-Debian distro' do before(:each) do diff --git a/spec/unit/facter/apt_dist_package_security_updates_spec.rb b/spec/unit/facter/apt_dist_package_security_updates_spec.rb index 6355b79..4033a28 100644 --- a/spec/unit/facter/apt_dist_package_security_updates_spec.rb +++ b/spec/unit/facter/apt_dist_package_security_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_package_security_dist_updates fact' do subject { Facter.fact(:apt_package_security_dist_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do diff --git a/spec/unit/facter/apt_dist_package_updates_spec.rb b/spec/unit/facter/apt_dist_package_updates_spec.rb index bbe212e..59e02b8 100644 --- a/spec/unit/facter/apt_dist_package_updates_spec.rb +++ b/spec/unit/facter/apt_dist_package_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_package_dist_updates fact' do subject { Facter.fact(:apt_package_dist_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do diff --git a/spec/unit/facter/apt_dist_security_updates_spec.rb b/spec/unit/facter/apt_dist_security_updates_spec.rb index 8035f16..895a36c 100644 --- a/spec/unit/facter/apt_dist_security_updates_spec.rb +++ b/spec/unit/facter/apt_dist_security_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_security_updates fact' do subject { Facter.fact(:apt_security_dist_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do diff --git a/spec/unit/facter/apt_dist_updates_spec.rb b/spec/unit/facter/apt_dist_updates_spec.rb index f9942af..112dca8 100644 --- a/spec/unit/facter/apt_dist_updates_spec.rb +++ b/spec/unit/facter/apt_dist_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_updates fact' do subject { Facter.fact(:apt_dist_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do diff --git a/spec/unit/facter/apt_has_updates_spec.rb b/spec/unit/facter/apt_has_updates_spec.rb index f7a1ca9..ea3e085 100644 --- a/spec/unit/facter/apt_has_updates_spec.rb +++ b/spec/unit/facter/apt_has_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_has_updates fact' do subject { Facter.fact(:apt_has_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'on non-Debian distro' do before(:each) do diff --git a/spec/unit/facter/apt_package_security_updates_spec.rb b/spec/unit/facter/apt_package_security_updates_spec.rb index 53b91bc..958fd00 100644 --- a/spec/unit/facter/apt_package_security_updates_spec.rb +++ b/spec/unit/facter/apt_package_security_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_package_security_updates fact' do subject { Facter.fact(:apt_package_security_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do diff --git a/spec/unit/facter/apt_package_updates_spec.rb b/spec/unit/facter/apt_package_updates_spec.rb index 4b3e749..4c81d0c 100644 --- a/spec/unit/facter/apt_package_updates_spec.rb +++ b/spec/unit/facter/apt_package_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_package_updates fact' do subject { Facter.fact(:apt_package_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do diff --git a/spec/unit/facter/apt_reboot_required_spec.rb b/spec/unit/facter/apt_reboot_required_spec.rb index b15cb4c..22f5617 100644 --- a/spec/unit/facter/apt_reboot_required_spec.rb +++ b/spec/unit/facter/apt_reboot_required_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_reboot_required fact' do subject { Facter.fact(:apt_reboot_required).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'if a reboot is required' do before(:each) do diff --git a/spec/unit/facter/apt_security_updates_spec.rb b/spec/unit/facter/apt_security_updates_spec.rb index cde0158..4e4b54d 100644 --- a/spec/unit/facter/apt_security_updates_spec.rb +++ b/spec/unit/facter/apt_security_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_security_updates fact' do subject { Facter.fact(:apt_security_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do diff --git a/spec/unit/facter/apt_update_last_success_spec.rb b/spec/unit/facter/apt_update_last_success_spec.rb index dc0fc54..f4858dd 100644 --- a/spec/unit/facter/apt_update_last_success_spec.rb +++ b/spec/unit/facter/apt_update_last_success_spec.rb @@ -4,7 +4,6 @@ describe 'apt_update_last_success fact' do subject { Facter.fact(:apt_update_last_success).value } before(:each) { Facter.clear } - after(:each) { Facter.clear } describe 'on Debian based distro which has not yet created the update-success-stamp file' do it 'has a value of -1' do diff --git a/spec/unit/facter/apt_updates_spec.rb b/spec/unit/facter/apt_updates_spec.rb index e9d4c0d..1f1c15b 100644 --- a/spec/unit/facter/apt_updates_spec.rb +++ b/spec/unit/facter/apt_updates_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'apt_updates fact' do subject { Facter.fact(:apt_updates).value } - after(:each) { Facter.clear } + before(:each) { Facter.clear } describe 'when apt has no updates' do before(:each) do