Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hostname facts for freebsd13 and add spec test #216

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions facts/4.0/freebsd-13-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
"uuid": "dc77188a-5cf2-e84a-9c9b-0cb604ae8808"
}
},
"domain": "divms.uiowa.edu",
"domain": "example.com",
"facterversion": "4.0.52",
"fqdn": "foo.example.com",
"gem_version": "~> 4.0.0",
"gid": "wheel",
"hardwareisa": "amd64",
"hardwaremodel": "amd64",
"hostname": "",
"hostname": "foo",
"id": "root",
"identity": {
"gid": 0,
Expand Down Expand Up @@ -301,8 +302,9 @@
"network_em0": "10.0.2.0",
"network_lo0": "127.0.0.0",
"networking": {
"domain": "divms.uiowa.edu",
"hostname": "",
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "foo",
"interfaces": {
"em0": {
"bindings": [
Expand Down
10 changes: 6 additions & 4 deletions facts/4.1/freebsd-13-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
"uuid": "dc77188a-5cf2-e84a-9c9b-0cb604ae8808"
}
},
"domain": "divms.uiowa.edu",
"domain": "example.com",
"facterversion": "4.1.1",
"fqdn": "foo.example.com",
"gem_version": "~> 4.1.0",
"gid": "wheel",
"hardwareisa": "amd64",
"hardwaremodel": "amd64",
"hostname": "",
"hostname": "foo",
"id": "root",
"identity": {
"gid": 0,
Expand Down Expand Up @@ -301,8 +302,9 @@
"network_em0": "10.0.2.0",
"network_lo0": "127.0.0.0",
"networking": {
"domain": "divms.uiowa.edu",
"hostname": "",
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "foo",
"interfaces": {
"em0": {
"bindings": [
Expand Down
10 changes: 6 additions & 4 deletions facts/4.2/freebsd-13-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
"uuid": "dc77188a-5cf2-e84a-9c9b-0cb604ae8808"
}
},
"domain": "divms.uiowa.edu",
"domain": "example.com",
"facterversion": "4.2.5",
"fqdn": "foo.example.com",
"gem_version": "~> 4.2.0",
"gid": "wheel",
"hardwareisa": "amd64",
"hardwaremodel": "amd64",
"hostname": "",
"hostname": "foo",
"id": "root",
"identity": {
"gid": 0,
Expand Down Expand Up @@ -301,8 +302,9 @@
"network_em0": "10.0.2.0",
"network_lo0": "127.0.0.0",
"networking": {
"domain": "divms.uiowa.edu",
"hostname": "",
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "foo",
"interfaces": {
"em0": {
"bindings": [
Expand Down
17 changes: 17 additions & 0 deletions spec/facts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@
'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
Expand Down Expand Up @@ -123,6 +136,10 @@
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
end
end
end
end