-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AAP-39884] - Improve code coverage and fix some minor issues in anal…
…ytics collection (#1207) https://issues.redhat.com/browse/AAP-39884 This PR covers: 1. Add more Pytest cases to improve code coverage for analytics collection 2. Fix errors when the audit_rule table is empty ``` Traceback (most recent call last): File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/insights_analytics_collector/collection.py", line 59, in gather result = self.fnc_collecting( ^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/eda-server/eda-server/src/aap_eda/analytics/analytics_collectors.py", line 289, in audit_rules_table audit_rules = _get_audit_rule_qs(since, until).values( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/query.py", line 1313, in values clone = self._values(*fields, **expressions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/query.py", line 1308, in _values clone.query.set_values(fields) File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2463, in set_values self.add_fields(field_names, True) File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2195, in add_fields raise FieldError( django.core.exceptions.FieldError: Cannot resolve keyword 'created_at' into field. Choices are: activation, activation_id, activation_pod_id, activationinstancejobinstance, auditrule, ended_at, git_hash, id, log_read_at, name, organization, organization_id, parent_type, rulebookprocesslog, rulebookprocessqueue, started_at, status, status_message, updated_at ``` 3. Fix the previous two failed Pytest cases: ``` FAILED tests/integration/analytics/test_gather_analytics.py::test_gather_analytics_invalid_settings[https://url-True-Analytics collection is done] - requests.exceptions.ConnectionError: HTTPSConnectionPool(host='url', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9acaca9950>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) FAILED tests/integration/analytics/test_gather_analytics.py::test_gather_analytics_command[--ship-INFO-Analytics collection is done] - requests.exceptions.ConnectionError: HTTPSConnectionPool(host='url', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9acb3f0a90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) ====== 2 failed, 922 passed, 24 skipped, 15 warnings in 391.17s (0:06:31) ====== ```
- Loading branch information
Showing
13 changed files
with
822 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.