-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not import 'insights.client.constants' in spec_cleaner
- it causes circular import issue when triggering data collection via 'insights-collect' command - instead of importing the constants from insights.client, this change sets the "rhsm_facts_file" to insights_config Signed-off-by: Xiangce Liu <[email protected]> rh-pre-commit.version: 2.3.1 rh-pre-commit.check-secrets: ENABLED
- Loading branch information
Showing
4 changed files
with
53 additions
and
11 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
39 changes: 39 additions & 0 deletions
39
insights/tests/client/core_collector/test_run_collection.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from mock.mock import patch | ||
|
||
from insights.client.archive import InsightsArchive | ||
from insights.client.config import InsightsConfig | ||
from insights.client.core_collector import CoreCollector | ||
|
||
|
||
@patch('insights.client.core_collector.logger') | ||
@patch('insights.client.core_collector.CoreCollector._write_egg_release', return_value=None) | ||
@patch('insights.client.core_collector.CoreCollector._write_blacklisted_specs', return_value=None) | ||
@patch('insights.client.core_collector.CoreCollector._write_blacklist_report', return_value=None) | ||
@patch('insights.client.core_collector.CoreCollector._write_tags', return_value=None) | ||
@patch('insights.client.core_collector.CoreCollector._write_version_info', return_value=None) | ||
@patch('insights.client.core_collector.CoreCollector._write_ansible_host', return_value=None) | ||
@patch('insights.client.core_collector.CoreCollector._write_display_name', return_value=None) | ||
@patch('insights.client.core_collector.CoreCollector._write_branch_info', return_value=None) | ||
@patch('insights.client.core_collector.systemd_notify_init_thread', return_value=None) | ||
@patch('insights.client.core_collector.InsightsArchive.create_archive_dir', return_value=None) | ||
@patch('insights.client.core_collector.collect', return_value=None) | ||
def test_run_collection( | ||
collect, | ||
create_archive_dir, | ||
systemd_notify_init_thread, | ||
_write_branch_info, | ||
_write_display_name, | ||
_write_ansible_host, | ||
_write_version_info, | ||
_write_tags, | ||
_write_blacklist_report, | ||
_write_blacklisted_specs, | ||
_write_egg_release, | ||
logger): | ||
conf = InsightsConfig() | ||
arch = InsightsArchive(conf) | ||
cc = CoreCollector(conf, arch) | ||
cc.run_collection({}, {}, {}) | ||
create_archive_dir.assert_called_once() | ||
collect.collect.assert_called_once() | ||
logger.debug.assert_called_with('Metadata collection finished.') |
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