Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test scenario for disconnected option of rh_cloud report #13210

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,11 +2207,13 @@ def enroll_ad_and_configure_external_auth(self, ad_data):
self.execute('systemctl daemon-reload && systemctl restart httpd.service').status == 0
)

def generate_inventory_report(self, org):
def generate_inventory_report(self, org, disconnected='false'):
"""Function to perform inventory upload."""
generate_report_task = 'ForemanInventoryUpload::Async::UploadReportJob'
timestamp = datetime.utcnow().strftime('%Y-%m-%d %H:%M')
self.api.Organization(id=org.id).rh_cloud_generate_report()
self.api.Organization(id=org.id).rh_cloud_generate_report(
data={'disconnected': disconnected}
)
wait_for(
lambda: self.api.ForemanTask()
.search(query={'search': f'{generate_report_task} and started_at >= "{timestamp}"'})[0]
Expand Down
5 changes: 3 additions & 2 deletions tests/foreman/api/test_rhcloud_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def test_inventory_upload_with_http_proxy():

@pytest.mark.run_in_one_thread
@pytest.mark.tier2
@pytest.mark.e2e
def test_include_parameter_tags_setting(
inventory_settings,
rhcloud_manifest_org,
Expand All @@ -237,7 +238,7 @@ def test_include_parameter_tags_setting(
2. Register a content host with satellite.
3. Create a host parameter with long text value.
4. Create Hostcollection with name containing double quotes.
5. Generate inventory report.
5. Generate inventory report with disconnected option.
6. Assert that generated report contains valid json file.
7. Observe the tag generated from the parameter.

Expand Down Expand Up @@ -272,7 +273,7 @@ def test_include_parameter_tags_setting(
local_report_path = robottelo_tmp_dir.joinpath(f'{gen_alphanumeric()}_{org.id}.tar.xz')
# Enable include_parameter_tags setting
module_target_sat.update_setting('include_parameter_tags', True)
module_target_sat.generate_inventory_report(org)
module_target_sat.generate_inventory_report(org, disconnected='true')
# Download report
module_target_sat.api.Organization(id=org.id).rh_cloud_download_report(
destination=local_report_path
Expand Down
Loading