From a184c456672e81a6d17124d79607c83499d856db Mon Sep 17 00:00:00 2001 From: Nocchia <133043574+NomakCooper@users.noreply.github.com> Date: Sat, 5 Apr 2025 18:25:46 +0000 Subject: [PATCH 1/7] sar_facts - testing PR --- plugins/modules/sar_facts.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/modules/sar_facts.py b/plugins/modules/sar_facts.py index 8b4674c..99590f6 100644 --- a/plugins/modules/sar_facts.py +++ b/plugins/modules/sar_facts.py @@ -85,13 +85,13 @@ RETURN = r''' ansible_facts: - description: > - A dictionary containing the SAR data collected from system logs. The key is dynamically determined - based on the O(type). - The value is a list of dictionaries where each dictionary represents a single data point with the following keys: - - V(date): The date for the measurement. - - V(time): The time for the measurement in 24-hour format. - - Additional keys corresponding to the performance metrics output from the C(sar) command. + description: + - A dictionary containing the SAR data collected. The key is dynamically determined based on the O(type). + - The dict name format is c(sar_). + - The value is a list of dictionaries where each dictionary represents a single data point with the following keys: + - RV(ansible_facts.sar_.date) The date for the measurement. + - V(time) The time for the measurement in 24-hour format. + - Additional keys corresponding to the performance metrics output from the C(sar) command. returned: always type: dict sample: { From 2f61092a7a02d64ebccaa5bd184f10be75aafe24 Mon Sep 17 00:00:00 2001 From: Nocchia <133043574+NomakCooper@users.noreply.github.com> Date: Sun, 6 Apr 2025 15:22:20 +0000 Subject: [PATCH 2/7] sar_facts - fix sanity and test units fail --- plugins/modules/sar_facts.py | 2 +- tests/unit/plugins/modules/test_sar_facts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/sar_facts.py b/plugins/modules/sar_facts.py index 99590f6..5a81a4f 100644 --- a/plugins/modules/sar_facts.py +++ b/plugins/modules/sar_facts.py @@ -89,7 +89,7 @@ - A dictionary containing the SAR data collected. The key is dynamically determined based on the O(type). - The dict name format is c(sar_). - The value is a list of dictionaries where each dictionary represents a single data point with the following keys: - - RV(ansible_facts.sar_.date) The date for the measurement. + - V(date) The date for the measurement. - V(time) The time for the measurement in 24-hour format. - Additional keys corresponding to the performance metrics output from the C(sar) command. returned: always diff --git a/tests/unit/plugins/modules/test_sar_facts.py b/tests/unit/plugins/modules/test_sar_facts.py index feede5d..ea60c4a 100644 --- a/tests/unit/plugins/modules/test_sar_facts.py +++ b/tests/unit/plugins/modules/test_sar_facts.py @@ -67,7 +67,7 @@ def test_sar_cpu(self): result_str = str(context.exception) # Verify that exit_json output contains expected SAR fact keys and values. self.assertIn("sar_cpu", result_str) - self.assertIn("5.00", result_str) + self.assertIn("6.00", result_str) self.assertIn("2025-05-01", result_str) self.assertIn("exit_json called", result_str) From 9d32706e86fff5172b492f510678e13d0ee5f9f1 Mon Sep 17 00:00:00 2001 From: Nocchia <133043574+NomakCooper@users.noreply.github.com> Date: Sun, 6 Apr 2025 15:29:49 +0000 Subject: [PATCH 3/7] sar_facts - fix sanity and test units fail --- plugins/modules/sar_facts.py | 2 +- tests/unit/plugins/modules/test_sar_facts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/sar_facts.py b/plugins/modules/sar_facts.py index 5a81a4f..f4cbe32 100644 --- a/plugins/modules/sar_facts.py +++ b/plugins/modules/sar_facts.py @@ -88,7 +88,7 @@ description: - A dictionary containing the SAR data collected. The key is dynamically determined based on the O(type). - The dict name format is c(sar_). - - The value is a list of dictionaries where each dictionary represents a single data point with the following keys: + - The value is a list of dictionaries where each dictionary represents a single data point with the following keys - V(date) The date for the measurement. - V(time) The time for the measurement in 24-hour format. - Additional keys corresponding to the performance metrics output from the C(sar) command. diff --git a/tests/unit/plugins/modules/test_sar_facts.py b/tests/unit/plugins/modules/test_sar_facts.py index ea60c4a..ade30ee 100644 --- a/tests/unit/plugins/modules/test_sar_facts.py +++ b/tests/unit/plugins/modules/test_sar_facts.py @@ -67,7 +67,7 @@ def test_sar_cpu(self): result_str = str(context.exception) # Verify that exit_json output contains expected SAR fact keys and values. self.assertIn("sar_cpu", result_str) - self.assertIn("6.00", result_str) + self.assertIn("8.00", result_str) self.assertIn("2025-05-01", result_str) self.assertIn("exit_json called", result_str) From 403f01b0b5a7679e15d46c70a44cc86e4b1cd46f Mon Sep 17 00:00:00 2001 From: Nocchia <133043574+NomakCooper@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:22:11 +0000 Subject: [PATCH 4/7] sar_facts - fix units test and test integration fail --- tests/integration/targets/sar_facts/tasks/tests.yml | 2 +- tests/unit/plugins/modules/test_sar_facts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/sar_facts/tasks/tests.yml b/tests/integration/targets/sar_facts/tasks/tests.yml index 93e824c..ef56ccf 100644 --- a/tests/integration/targets/sar_facts/tasks/tests.yml +++ b/tests/integration/targets/sar_facts/tasks/tests.yml @@ -10,7 +10,7 @@ - name: Skip SAR facts test if SAR binary is not available meta: end_play - when: sar_bin.rc != 0 + when: sar_bin.rc != 1 - name: Get current date dynamically ansible.builtin.set_fact: diff --git a/tests/unit/plugins/modules/test_sar_facts.py b/tests/unit/plugins/modules/test_sar_facts.py index ade30ee..feede5d 100644 --- a/tests/unit/plugins/modules/test_sar_facts.py +++ b/tests/unit/plugins/modules/test_sar_facts.py @@ -67,7 +67,7 @@ def test_sar_cpu(self): result_str = str(context.exception) # Verify that exit_json output contains expected SAR fact keys and values. self.assertIn("sar_cpu", result_str) - self.assertIn("8.00", result_str) + self.assertIn("5.00", result_str) self.assertIn("2025-05-01", result_str) self.assertIn("exit_json called", result_str) From 26ac58fae700bfca7191d361776868443f5cc271 Mon Sep 17 00:00:00 2001 From: Nocchia <133043574+NomakCooper@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:35:50 +0000 Subject: [PATCH 5/7] sar_facts - fix integration and fail units --- tests/integration/targets/sar_facts/tasks/tests.yml | 2 +- tests/unit/plugins/modules/test_sar_facts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/sar_facts/tasks/tests.yml b/tests/integration/targets/sar_facts/tasks/tests.yml index ef56ccf..93e824c 100644 --- a/tests/integration/targets/sar_facts/tasks/tests.yml +++ b/tests/integration/targets/sar_facts/tasks/tests.yml @@ -10,7 +10,7 @@ - name: Skip SAR facts test if SAR binary is not available meta: end_play - when: sar_bin.rc != 1 + when: sar_bin.rc != 0 - name: Get current date dynamically ansible.builtin.set_fact: diff --git a/tests/unit/plugins/modules/test_sar_facts.py b/tests/unit/plugins/modules/test_sar_facts.py index feede5d..3f2eace 100644 --- a/tests/unit/plugins/modules/test_sar_facts.py +++ b/tests/unit/plugins/modules/test_sar_facts.py @@ -67,7 +67,7 @@ def test_sar_cpu(self): result_str = str(context.exception) # Verify that exit_json output contains expected SAR fact keys and values. self.assertIn("sar_cpu", result_str) - self.assertIn("5.00", result_str) + self.assertIn("9.00", result_str) self.assertIn("2025-05-01", result_str) self.assertIn("exit_json called", result_str) From 0b3d8541238df4b1aa29610f3b74e3a43b83473f Mon Sep 17 00:00:00 2001 From: Nocchia <133043574+NomakCooper@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:40:33 +0000 Subject: [PATCH 6/7] sar_facts - fix units and fail sanity --- plugins/modules/sar_facts.py | 2 +- tests/unit/plugins/modules/test_sar_facts.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/sar_facts.py b/plugins/modules/sar_facts.py index f4cbe32..e317731 100644 --- a/plugins/modules/sar_facts.py +++ b/plugins/modules/sar_facts.py @@ -89,7 +89,7 @@ - A dictionary containing the SAR data collected. The key is dynamically determined based on the O(type). - The dict name format is c(sar_). - The value is a list of dictionaries where each dictionary represents a single data point with the following keys - - V(date) The date for the measurement. + - RV(date) The date for the measurement. - V(time) The time for the measurement in 24-hour format. - Additional keys corresponding to the performance metrics output from the C(sar) command. returned: always diff --git a/tests/unit/plugins/modules/test_sar_facts.py b/tests/unit/plugins/modules/test_sar_facts.py index 3f2eace..feede5d 100644 --- a/tests/unit/plugins/modules/test_sar_facts.py +++ b/tests/unit/plugins/modules/test_sar_facts.py @@ -67,7 +67,7 @@ def test_sar_cpu(self): result_str = str(context.exception) # Verify that exit_json output contains expected SAR fact keys and values. self.assertIn("sar_cpu", result_str) - self.assertIn("9.00", result_str) + self.assertIn("5.00", result_str) self.assertIn("2025-05-01", result_str) self.assertIn("exit_json called", result_str) From 17d0066bcd98074ca9feeaa614ce7a5ce55f39f3 Mon Sep 17 00:00:00 2001 From: Nocchia <133043574+NomakCooper@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:47:09 +0000 Subject: [PATCH 7/7] sar_facts - fix sanity --- plugins/modules/sar_facts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/sar_facts.py b/plugins/modules/sar_facts.py index e317731..f4cbe32 100644 --- a/plugins/modules/sar_facts.py +++ b/plugins/modules/sar_facts.py @@ -89,7 +89,7 @@ - A dictionary containing the SAR data collected. The key is dynamically determined based on the O(type). - The dict name format is c(sar_). - The value is a list of dictionaries where each dictionary represents a single data point with the following keys - - RV(date) The date for the measurement. + - V(date) The date for the measurement. - V(time) The time for the measurement in 24-hour format. - Additional keys corresponding to the performance metrics output from the C(sar) command. returned: always