Skip to content

Conversation

Satellite-QE
Copy link
Collaborator

Cherrypick of PR: #20028

Problem Statement

The CLI test for syncing Lightpseed inventory status is failing due to its reliance on the foreman-rake rh_cloud_inventory:sync rake task. This command syncs the inventory for all organization on a Satellite and does not respect options passed in to restrict the scope of the command to a single org. As a result, in CI, when the test searches for an inventory sync task on which to make assertions, it often erroneously finds a sync task for an organization other than the one being tested.

Additionally, syncing the inventory via the foreman-rake CLI is not a documented approach, and the foreman-rake CLI is typically not a supported customer use case.

Solution

Convert the CLI inventory sync test to a UI test, which uses a supported workflow and restricts the sync to the selected org by default.

* Convert Lightspeed inventory sync from CLI to UI

The CLI test for syncing Lightpseed inventory status is failing due to
its reliance on the `foreman-rake rh_cloud_inventory:sync` rake task.
This command syncs the inventory for all organization on a Satellite and
does not respect options passed in to restrict the scope of the command
to a single org. As a result, in CI, when the test searches for an
inventory sync task on which to make assertions, it often erroneously
finds a sync task for an organization other than the one being tested.

Additionally, syncing the inventory via the `foreman-rake` CLI is not a
documented approach, and the `foreman-rake` CLI is typically not a
supported customer use case.

This PR converts the CLI inventory sync test to a UI test, which uses a
supported workflow and restricts the sync to the selected org by
default.

* Address reviewer feedback

(cherry picked from commit 3ee1bef)
@Satellite-QE Satellite-QE added 6.18.z Introduced in or relating directly to Satellite 6.18 Auto_Cherry_Picked Automatically cherrypicked PR using GHA No-CherryPick PR doesnt need CherryPick to previous branches labels Oct 21, 2025
@Satellite-QE
Copy link
Collaborator Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_rhcloud_inventory.py::test_sync_inventory_status

@Satellite-QE Satellite-QE added the AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing label Oct 21, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Consider extracting the shared wait_for + ForemanTask search logic into a reusable helper to reduce duplication across your inventory sync tests.
  • It would strengthen the test to include a UI-based assertion (e.g. verifying host statuses or sync state in the UI) after the sync, not just checking the API task output.
  • Capture the timestamp immediately after triggering the sync in the UI session rather than before, to avoid potential race conditions if UI interactions delay task execution.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the shared wait_for + ForemanTask search logic into a reusable helper to reduce duplication across your inventory sync tests.
- It would strengthen the test to include a UI-based assertion (e.g. verifying host statuses or sync state in the UI) after the sync, not just checking the API task output.
- Capture the timestamp immediately after triggering the sync in the UI session rather than before, to avoid potential race conditions if UI interactions delay task execution.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Satellite-QE
Copy link
Collaborator Author

PRT Result

Build Number: 13240
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_rhcloud_inventory.py::test_sync_inventory_status --external-logging
Test Result : ================= 4 passed, 61 warnings in 1300.67s (0:21:40) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Oct 21, 2025
@Satellite-QE Satellite-QE merged commit 9ab05ca into 6.18.z Oct 21, 2025
18 of 19 checks passed
@Satellite-QE Satellite-QE deleted the cherry-pick-6.18.z-3ee1befebb0e438159ef0a1cbd5f98610836ddb4 branch October 21, 2025 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.18.z Introduced in or relating directly to Satellite 6.18 Auto_Cherry_Picked Automatically cherrypicked PR using GHA AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants