From 393b90098240c66778926b8c43084f866906fd41 Mon Sep 17 00:00:00 2001 From: cocker-cc Date: Tue, 24 Oct 2023 18:52:45 +0200 Subject: [PATCH] Remove legacy Facts from Rspec-Tests --- README.md | 6 +-- ...datadog_agent_integrations_haproxy_spec.rb | 1 - spec/classes/datadog_agent_redhat_spec.rb | 25 ----------- spec/classes/datadog_agent_reports_spec.rb | 11 ----- spec/classes/datadog_agent_spec.rb | 43 +++---------------- spec/classes/datadog_agent_suse_spec.rb | 4 -- spec/classes/datadog_agent_ubuntu_spec.rb | 18 -------- ...datadog_agent__install_integration_spec.rb | 3 -- 8 files changed, 8 insertions(+), 103 deletions(-) diff --git a/README.md b/README.md index 6a6a9eeb..86fe3d24 100644 --- a/README.md +++ b/README.md @@ -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, } ``` @@ -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, } ``` @@ -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 => "", - facts_to_tags => ["osfamily","networking.domain","my_custom_fact"], + facts_to_tags => ["os.family","networking.domain","my_custom_fact"], } ``` diff --git a/spec/classes/datadog_agent_integrations_haproxy_spec.rb b/spec/classes/datadog_agent_integrations_haproxy_spec.rb index 999f1176..cd03c8a5 100644 --- a/spec/classes/datadog_agent_integrations_haproxy_spec.rb +++ b/spec/classes/datadog_agent_integrations_haproxy_spec.rb @@ -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 diff --git a/spec/classes/datadog_agent_redhat_spec.rb b/spec/classes/datadog_agent_redhat_spec.rb index bf6362e3..889cc9ea 100644 --- a/spec/classes/datadog_agent_redhat_spec.rb +++ b/spec/classes/datadog_agent_redhat_spec.rb @@ -8,9 +8,6 @@ let(:facts) do { - osfamily: 'redhat', - operatingsystem: 'Fedora', - architecture: 'x86_64', os: { 'architecture' => 'x86_64', 'family' => 'redhat', @@ -67,9 +64,6 @@ context 'agent 6' do let(:facts) do { - osfamily: 'redhat', - operatingsystem: 'Fedora', - architecture: 'x86_64', os: { 'architecture' => 'x86_64', 'family' => 'redhat', @@ -126,9 +120,6 @@ context 'agent 7' do let(:facts) do { - osfamily: 'redhat', - operatingsystem: 'Fedora', - architecture: 'x86_64', os: { 'architecture' => 'x86_64', 'family' => 'redhat', @@ -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', @@ -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', @@ -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', @@ -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', diff --git a/spec/classes/datadog_agent_reports_spec.rb b/spec/classes/datadog_agent_reports_spec.rb index 8ef1239f..a88c2041 100644 --- a/spec/classes/datadog_agent_reports_spec.rb +++ b/spec/classes/datadog_agent_reports_spec.rb @@ -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), @@ -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', @@ -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', @@ -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', @@ -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', diff --git a/spec/classes/datadog_agent_spec.rb b/spec/classes/datadog_agent_spec.rb index f88bc711..d765197e 100644 --- a/spec/classes/datadog_agent_spec.rb +++ b/spec/classes/datadog_agent_spec.rb @@ -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', @@ -36,8 +34,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -64,8 +60,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -92,8 +86,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -120,8 +112,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -148,8 +138,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -176,8 +164,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -204,8 +190,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -234,8 +218,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -260,8 +242,6 @@ context 'windows NPM' do let(:facts) do { - osfamily: 'windows', - operatingsystem: 'Windows', os: { 'architecture' => 'x86_64', 'family' => 'windows', @@ -316,8 +296,6 @@ ALL_OS.each do |operatingsystem| let(:facts) do { - operatingsystem: operatingsystem, - osfamily: getosfamily(operatingsystem), os: { 'architecture' => 'x86_64', 'family' => getosfamily(operatingsystem), @@ -367,8 +345,6 @@ end let(:facts) do { - operatingsystem: operatingsystem, - osfamily: getosfamily(operatingsystem), os: { 'architecture' => 'x86_64', 'family' => getosfamily(operatingsystem), @@ -1728,8 +1704,6 @@ end let(:facts) do { - operatingsystem: operatingsystem, - osfamily: getosfamily(operatingsystem), os: { 'architecture' => 'x86_64', 'family' => getosfamily(operatingsystem), @@ -1763,8 +1737,6 @@ end let(:facts) do { - operatingsystem: operatingsystem, - osfamily: getosfamily(operatingsystem), os: { 'architecture' => 'x86_64', 'family' => getosfamily(operatingsystem), @@ -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', @@ -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 @@ -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' => { @@ -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 @@ -2463,9 +2431,8 @@ end let(:facts) do { - operatingsystem: 'CentOS', - osfamily: 'redhat', facts_array: ['one', 'two'], + osfamily: 'redhat', os: { 'architecture' => 'x86_64', 'family' => 'redhat', diff --git a/spec/classes/datadog_agent_suse_spec.rb b/spec/classes/datadog_agent_suse_spec.rb index 125e8021..fbfe5e7a 100644 --- a/spec/classes/datadog_agent_suse_spec.rb +++ b/spec/classes/datadog_agent_suse_spec.rb @@ -7,8 +7,6 @@ let(:facts) do { - operatingsystem: 'OpenSuSE', - architecture: 'x86_64', os: { 'architecture' => 'x86_64', 'family' => 'redhat', @@ -24,7 +22,6 @@ context 'suse >= 15' do let(:facts) do { - operatingsystemmajrelease: '15', os: { 'architecture' => 'x86_64', 'family' => 'redhat', @@ -81,7 +78,6 @@ context 'suse < 15' do let(:facts) do { - operatingsystemmajrelease: '14', os: { 'architecture' => 'x86_64', 'family' => 'redhat', diff --git a/spec/classes/datadog_agent_ubuntu_spec.rb b/spec/classes/datadog_agent_ubuntu_spec.rb index 2fb98a48..6de162e5 100644 --- a/spec/classes/datadog_agent_ubuntu_spec.rb +++ b/spec/classes/datadog_agent_ubuntu_spec.rb @@ -34,8 +34,6 @@ end let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -88,8 +86,6 @@ let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -142,8 +138,6 @@ let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -193,9 +187,6 @@ let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', - operatingsystemrelease: '14.04', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -220,9 +211,6 @@ let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Ubuntu', - operatingsystemrelease: '16.04', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -247,9 +235,6 @@ let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Debian', - operatingsystemrelease: '8.0', os: { 'architecture' => 'x86_64', 'family' => 'debian', @@ -274,9 +259,6 @@ let(:facts) do { - osfamily: 'debian', - operatingsystem: 'Debian', - operatingsystemrelease: '9.0', os: { 'architecture' => 'x86_64', 'family' => 'debian', diff --git a/spec/defines/datadog_agent__install_integration_spec.rb b/spec/defines/datadog_agent__install_integration_spec.rb index d5404670..4ad2ef51 100644 --- a/spec/defines/datadog_agent__install_integration_spec.rb +++ b/spec/defines/datadog_agent__install_integration_spec.rb @@ -5,9 +5,6 @@ ALL_OS.each do |operatingsystem| let(:facts) do { - operatingsystem: operatingsystem, - osfamily: getosfamily(operatingsystem), - operatingsystemrelease: getosrelease(operatingsystem), os: { 'architecture' => 'x86_64', 'family' => getosfamily(operatingsystem),