coi-gov-pl / rspec-puppet-facts-unsupported

Helpers to generate unsupported OS facts to test for proper fail
Other
1 stars 1 forks source link

Fails with facterdb 0.8.1 #3

Open baurmatt opened 5 years ago

baurmatt commented 5 years ago
$ bundle exec rspec spec/classes/failures_spec.rb:101
Failed to retrieve Augeas version: cannot load such file -- augeas
Shuffling unsupported OS's facts with seed: 32216
Set environment variable to reproduce this order, for ex. on Linux `export RSPEC_PUPPET_FACTS_UNSUPPORTED_ORDER=32216`

An error occurred while loading ./spec/classes/failures_spec.rb.
Failure/Error:
  on_unsupported_os.each do |os, os_facts|
    context "with unsupported #{os}" do
      let(:facts) do
        os_facts.merge(
          'sys11_ipaddress_private' => sys11_ipaddress_private,
          'memory' => {
            'system' => {
              'total_bytes' => memory_total_bytes,
            },
          },

NoMethodError:
  undefined method `downcase' for nil:NilClass
# /Users/mbaur/.rvm/gems/ruby-2.5.3/gems/rspec-puppet-facts-unsupported-0.1.1/lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb:268:in `describe_os'
# /Users/mbaur/.rvm/gems/ruby-2.5.3/gems/rspec-puppet-facts-unsupported-0.1.1/lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb:251:in `block in postprocess_facts'
# /Users/mbaur/.rvm/gems/ruby-2.5.3/gems/rspec-puppet-facts-unsupported-0.1.1/lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb:250:in `map'
# /Users/mbaur/.rvm/gems/ruby-2.5.3/gems/rspec-puppet-facts-unsupported-0.1.1/lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb:250:in `postprocess_facts'
# /Users/mbaur/.rvm/gems/ruby-2.5.3/gems/rspec-puppet-facts-unsupported-0.1.1/lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb:232:in `facts'
# /Users/mbaur/.rvm/gems/ruby-2.5.3/gems/rspec-puppet-facts-unsupported-0.1.1/lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb:27:in `on_unsupported_os'
# ./spec/classes/failures_spec.rb:101:in `block in <top (required)>'
# ./spec/classes/failures_spec.rb:6:in `<top (required)>'
Run options: include {:locations=>{"./spec/classes/failures_spec.rb"=>[101]}}
Total resources:   0
Touched resources: 0
Resource coverage:   NaN%

Finished in 0.00134 seconds (files took 5.27 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

This happens because of new SLES 15 SP1 fact sets which got introduced with 0.8.1 (https://github.com/camptocamp/facterdb/pull/121). Those fact sets don't have a "operatingsystem" set because facter 2.5 can't retrieve it. As facter 2.5 is deprecated and get soon replaced by Facter NG (https://groups.io/g/voxpupuli/message/302) it would be great if we could simply fail safely in rspec-puppet-facts-unsupported.

baurmatt commented 5 years ago

I will provide a PR.