Skip to content

Commit

Permalink
Remove legacy Facts from Rspec-Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cocker-cc committed Oct 24, 2023
1 parent 7ff14d8 commit 393b900
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 103 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ To enable the Datadog Agent Network Performance Monitoring (NPM) features follow
```conf
class { 'datadog_agent::system_probe':
network_enabled => true,
network_enabled => true,
}
```
Expand All @@ -214,7 +214,7 @@ To enable the Datadog Agent Universal Service Monitoring (USM) use the `datadog_
```conf
class { 'datadog_agent::system_probe':
service_monitoring_enabled => true,
service_monitoring_enabled => true,
}
```
Expand Down Expand Up @@ -276,7 +276,7 @@ To generate tags from custom facts classify your nodes with Puppet facts as an a
```conf
class { "datadog_agent":
api_key => "<YOUR_DD_API_KEY>",
facts_to_tags => ["osfamily","networking.domain","my_custom_fact"],
facts_to_tags => ["os.family","networking.domain","my_custom_fact"],
}
```
Expand Down
1 change: 0 additions & 1 deletion spec/classes/datadog_agent_integrations_haproxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
let(:pre_condition) { "class {'::datadog_agent': agent_major_version => #{agent_major_version}}" }
let(:facts) do
{
ipaddress: '1.2.3.4',
networking: { 'ip' => '1.2.3.4' },
}
end
Expand Down
25 changes: 0 additions & 25 deletions spec/classes/datadog_agent_redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

let(:facts) do
{
osfamily: 'redhat',
operatingsystem: 'Fedora',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down Expand Up @@ -67,9 +64,6 @@
context 'agent 6' do
let(:facts) do
{
osfamily: 'redhat',
operatingsystem: 'Fedora',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down Expand Up @@ -126,9 +120,6 @@
context 'agent 7' do
let(:facts) do
{
osfamily: 'redhat',
operatingsystem: 'Fedora',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down Expand Up @@ -187,10 +178,6 @@
# we expect repo_gpgcheck to be false on 8.1
let(:facts) do
{
osfamily: 'redhat',
operatingsystem: 'RedHat',
operatingsystemrelease: '8.1',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down Expand Up @@ -229,10 +216,6 @@
# we expect repo_gpgcheck to be true on 8.2 (and later)
let(:facts) do
{
osfamily: 'redhat',
operatingsystem: 'RedHat',
operatingsystemrelease: '8.2',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down Expand Up @@ -271,10 +254,6 @@
context 'almalinux 8', if: min_puppet_version('7.12.0') do
let(:facts) do
{
osfamily: 'redhat',
operatingsystem: 'AlmaLinux',
operatingsystemrelease: '8.5',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down Expand Up @@ -312,10 +291,6 @@
context 'rocky 8', if: min_puppet_version('7.12.0') do
let(:facts) do
{
osfamily: 'redhat',
operatingsystem: 'Rocky',
operatingsystemrelease: '8.5',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down
11 changes: 0 additions & 11 deletions spec/classes/datadog_agent_reports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
describe "datadog_agent class common actions on #{operatingsystem}" do
let(:facts) do
{
operatingsystem: operatingsystem,
osfamily: getosfamily(operatingsystem),
operatingsystemrelease: getosrelease(operatingsystem),
os: {
'architecture' => 'x86_64',
'family' => getosfamily(operatingsystem),
Expand Down Expand Up @@ -90,8 +87,6 @@
describe 'datadog_agent class dogapi version override' do
let(:facts) do
{
operatingsystem: 'Debian',
osfamily: 'debian',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand Down Expand Up @@ -141,8 +136,6 @@
describe 'datadog_agent class puppet gem provider override' do
let(:facts) do
{
operatingsystem: 'Debian',
osfamily: 'debian',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand Down Expand Up @@ -187,8 +180,6 @@
describe 'datadog_agent class dogapi version override' do
let(:facts) do
{
operatingsystem: 'Debian',
osfamily: 'debian',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand Down Expand Up @@ -235,8 +226,6 @@
describe 'datadog_agent class dogapi version override' do
let(:facts) do
{
operatingsystem: 'Debian',
osfamily: 'debian',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand Down
43 changes: 5 additions & 38 deletions spec/classes/datadog_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
describe 'datadog_agent class without any parameters on Solaris/Nexenta' do
let(:facts) do
{
osfamily: 'Solaris',
operatingsystem: 'Nexenta',
os: {
'architecture' => 'x86_64',
'family' => 'Solaris',
Expand Down Expand Up @@ -36,8 +34,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand All @@ -64,8 +60,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand All @@ -92,8 +86,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand All @@ -120,8 +112,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand All @@ -148,8 +138,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand All @@ -176,8 +164,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand All @@ -204,8 +190,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand Down Expand Up @@ -234,8 +218,6 @@
end
let(:facts) do
{
osfamily: 'debian',
operatingsystem: 'Ubuntu',
os: {
'architecture' => 'x86_64',
'family' => 'debian',
Expand All @@ -260,8 +242,6 @@
context 'windows NPM' do
let(:facts) do
{
osfamily: 'windows',
operatingsystem: 'Windows',
os: {
'architecture' => 'x86_64',
'family' => 'windows',
Expand Down Expand Up @@ -316,8 +296,6 @@
ALL_OS.each do |operatingsystem|
let(:facts) do
{
operatingsystem: operatingsystem,
osfamily: getosfamily(operatingsystem),
os: {
'architecture' => 'x86_64',
'family' => getosfamily(operatingsystem),
Expand Down Expand Up @@ -367,8 +345,6 @@
end
let(:facts) do
{
operatingsystem: operatingsystem,
osfamily: getosfamily(operatingsystem),
os: {
'architecture' => 'x86_64',
'family' => getosfamily(operatingsystem),
Expand Down Expand Up @@ -1728,8 +1704,6 @@
end
let(:facts) do
{
operatingsystem: operatingsystem,
osfamily: getosfamily(operatingsystem),
os: {
'architecture' => 'x86_64',
'family' => getosfamily(operatingsystem),
Expand Down Expand Up @@ -1763,8 +1737,6 @@
end
let(:facts) do
{
operatingsystem: operatingsystem,
osfamily: getosfamily(operatingsystem),
os: {
'architecture' => 'x86_64',
'family' => getosfamily(operatingsystem),
Expand Down Expand Up @@ -2375,14 +2347,12 @@
{
agent_major_version: 6,
puppet_run_reports: true,
facts_to_tags: ['osfamily'],
facts_to_tags: ['os.family'],
trusted_facts_to_tags: ['extensions.trusted_fact', 'extensions.facts_array', 'extensions.facts_hash.actor.first_name'],
}
end
let(:facts) do
{
'operatingsystem' => 'CentOS',
'osfamily' => 'redhat',
'os' => {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand All @@ -2409,7 +2379,7 @@

it do
is_expected.to contain_file('/etc/datadog-agent/datadog.yaml')
.with_content(%r{tags:\n- osfamily:redhat\n- extensions.trusted_fact:test\n- extensions.facts_array:one\n- extensions.facts_array:two\n- extensions.facts_hash.actor.first_name:Macaulay})
.with_content(%r{tags:\n- os.family:redhat\n- extensions.trusted_fact:test\n- extensions.facts_array:one\n- extensions.facts_array:two\n- extensions.facts_hash.actor.first_name:Macaulay})
end
end
end
Expand All @@ -2420,13 +2390,11 @@
{
agent_major_version: 6,
puppet_run_reports: true,
facts_to_tags: ['osfamily', 'facts_array', 'facts_hash.actor.first_name', 'looks.like.a.path'],
facts_to_tags: ['os.family', 'facts_array', 'facts_hash.actor.first_name', 'looks.like.a.path'],
}
end
let(:facts) do
{
'operatingsystem' => 'CentOS',
'osfamily' => 'redhat',
'facts_array' => ['one', 'two'],
'facts_hash' => {
'actor' => {
Expand All @@ -2449,7 +2417,7 @@

it do
is_expected.to contain_file('/etc/datadog-agent/datadog.yaml')
.with_content(%r{tags:\n- osfamily:redhat\n- facts_array:one\n- facts_array:two\n- facts_hash.actor.first_name:Macaulay\n- looks.like.a.path:but_its_not})
.with_content(%r{tags:\n- os.family:redhat\n- facts_array:one\n- facts_array:two\n- facts_hash.actor.first_name:Macaulay\n- looks.like.a.path:but_its_not})
end
end

Expand All @@ -2463,9 +2431,8 @@
end
let(:facts) do
{
operatingsystem: 'CentOS',
osfamily: 'redhat',
facts_array: ['one', 'two'],
osfamily: 'redhat',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down
4 changes: 0 additions & 4 deletions spec/classes/datadog_agent_suse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

let(:facts) do
{
operatingsystem: 'OpenSuSE',
architecture: 'x86_64',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand All @@ -24,7 +22,6 @@
context 'suse >= 15' do
let(:facts) do
{
operatingsystemmajrelease: '15',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down Expand Up @@ -81,7 +78,6 @@
context 'suse < 15' do
let(:facts) do
{
operatingsystemmajrelease: '14',
os: {
'architecture' => 'x86_64',
'family' => 'redhat',
Expand Down
Loading

0 comments on commit 393b900

Please sign in to comment.