spec/facts_spec.rb in facterdb-1.12.1 vs spec/facts_spec.rb in facterdb-1.12.2

- old
+ new

@@ -60,43 +60,10 @@ expect(file_hashes[file_hash]).to have_a_unique_hash end end end - KNOWN_IPADDRESS_PENDING = { - 'facts/1.6/fedora-19-i386.facts' => 'unable to regenerate facts', - 'facts/1.6/fedora-19-x86_64.facts' => 'unable to regenerate facts', - 'facts/2.1/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/3.10/ubuntu-18.04-aarch64.facts' => 'unable to regenerate facts', - 'facts/1.6/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/2.4/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/3.2/aix-61-powerpc.facts' => 'unable to regenerate facts', - 'facts/3.2/aix-71-powerpc.facts' => 'unable to regenerate facts', - 'facts/3.2/aix-53-powerpc.facts' => 'unable to regenerate facts', - 'facts/2.3/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/2.5/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/1.7/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/2.0/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/2.2/archlinux-x86_64.facts' => 'no ifconfig package', - 'facts/3.6/pcs-6-x86_64.facts' => 'unable to regenerate facts', - 'facts/3.0/ubuntu-15.10-x86_64.facts' => 'no puppet-agent package', - 'facts/3.0/ubuntu-15.10-i386.facts' => 'no puppet-agent package', - } - - KNOWN_HOSTNAME_PENDING = { - 'facts/3.10/ubuntu-18.04-aarch64.facts' => 'unable to regenerate facts', - 'facts/3.2/aix-61-powerpc.facts' => 'unable to regenerate facts', - 'facts/3.2/aix-71-powerpc.facts' => 'unable to regenerate facts', - 'facts/3.2/aix-53-powerpc.facts' => 'unable to regenerate facts', - 'facts/3.6/pcs-6-x86_64.facts' => 'unable to regenerate facts', - 'facts/3.0/ubuntu-15.10-x86_64.facts' => 'no puppet-agent package', - 'facts/3.0/ubuntu-15.10-i386.facts' => 'no puppet-agent package', - 'facts/4.2/centos-9-x86_64.facts' => 'no legacy facts', - 'facts/4.2/oraclelinux-9-x86_64.facts' => 'no legacy facts', - 'facts/4.2/redhat-9-x86_64.facts' => 'no legacy facts', - } - project_dir = Pathname.new(__dir__).parent FacterDB.default_fact_files.each do |filepath| relative_path = Pathname.new(filepath).relative_path_from(project_dir).to_s describe relative_path do subject(:content) do @@ -111,19 +78,21 @@ facter_dir_path = File.basename(File.dirname(filepath)) expect(content['facterversion']).to have_facter_version(facter_dir_path, filepath) end - it 'contains an ipaddress or networking.ip fact' do - pending KNOWN_IPADDRESS_PENDING[relative_path] if KNOWN_IPADDRESS_PENDING.key?(relative_path) - case content['facterversion'] - when /^[1-3]/ - expect(content['ipaddress']).to not_be_nil.and not_be_empty - else + it 'contains newer networking facts hash' do + if Gem::Version.new(content['facterversion']) >= Gem::Version.new('3.0.0') expect(content['networking']['ip']).to not_be_nil.and not_be_empty + expect(content['networking']['hostname']).to eq('foo') + expect(content['networking']['domain']).to eq('example.com') + expect(content['networking']['fqdn']).to eq('foo.example.com') end end + it 'contains the legacy ipaddress fact' do + expect(content['ipaddress']).to not_be_nil.and not_be_empty + end it 'contains no facts from puppetlabs/stdlib' do expect(content['root_home']).to be_nil expect(content['service_provider']).to be_nil expect(content['puppet_vardir']).to be_nil expect(content['puppet_environmentpath']).to be_nil @@ -134,12 +103,13 @@ it 'contains no facts from puppet/systemd' do expect(content['systemd']).to be_nil expect(content['systemd_version']).to be_nil expect(content['systemd_internal_services']).to be_nil end - it 'contains a hostname fact' do - pending KNOWN_HOSTNAME_PENDING[relative_path] if KNOWN_HOSTNAME_PENDING.key?(relative_path) - expect(content['hostname']).to not_be_nil.and not_be_empty + it 'contains a legacy hostname, domain and fqdn fact' do + expect(content['hostname']).to eq('foo') + expect(content['fqdn']).to eq('foo.example.com') + expect(content['domain']).to eq('example.com') end end end end