Skip to content

Update test_positive_all_hosts_check_status_icon#21521

Open
LadislavVasina1 wants to merge 3 commits into
SatelliteQE:masterfrom
LadislavVasina1:updateAllHostsStatusIconCheckTest
Open

Update test_positive_all_hosts_check_status_icon#21521
LadislavVasina1 wants to merge 3 commits into
SatelliteQE:masterfrom
LadislavVasina1:updateAllHostsStatusIconCheckTest

Conversation

@LadislavVasina1
Copy link
Copy Markdown
Contributor

@LadislavVasina1 LadislavVasina1 commented May 12, 2026

Problem Statement

After the fix for SAT-42220 (https://redhat.atlassian.net/browse/SAT-42220) (host status dynamically recalculated on new All Hosts page), the existing test_positive_all_hosts_check_status_icon started failing.
The test previously asserted success status for the Satellite host, but that only worked because global_status was stale in the database — the exact bug SAT-42220 fixed.
Additionally, the test had misleading variable names (warning_host expected danger, error_host expected warning).

Solution

  • Fixed broken assertion: Replaced the hardcoded success assertion on the Satellite host (which relied on stale status) with a dedicated content host registered with content and latest packages installed
  • Added success status coverage: Added a third content host (rhel_contenthost) that verifies success status when all errata are applied
  • Renamed misleading variables: warning_host/error_host → errata_host/no_profile_host to match their actual purpose
  • Reordered assertions: success assertion runs last so danger and warning checks execute regardless
  • Added :Verifies: SAT-42220 to the test docstring

Related Issues

Needs: theforeman/foreman#10993

PRT test Cases example

image
trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py -k 'test_positive_all_hosts_check_status_icon'
theforeman:
    foreman: 10993

Summary by Sourcery

Tests:

  • Adjust the status-icon UI test to create and register three RHEL content hosts representing danger (security errata), warning (no package profile), and success (Insights disabled, remote execution enabled), and assert their respective status icons and details.

@LadislavVasina1 LadislavVasina1 self-assigned this May 12, 2026
@LadislavVasina1 LadislavVasina1 added CherryPick PR needs CherryPick to previous branches AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing Stream Introduced in or relating directly to Satellite Stream/Master 6.19.z labels May 12, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 12, 2026

Reviewer's Guide

Expands and refactors the All Hosts status icon UI test to use dedicated content hosts for each status (success, danger, warning), sets up their states more realistically via registration and package operations, and validates the dynamically recalculated status icons and details in the UI.

File-Level Changes

Change Details Files
Refactor host role assignments in the status icon test to use dedicated RHEL/content hosts for success, errata, and no-profile scenarios.
  • Introduce rhel_contenthost fixture as the success host and repurpose content_hosts[0] and content_hosts[1] as errata and no-profile hosts respectively
  • Remove use of target_sat as the success host and clarify host naming for each scenario
tests/foreman/ui/test_host.py
Add explicit setup for errata host by registering, configuring repos, and manipulating packages to generate applicable security errata.
  • Configure remote execution key and custom repos on the errata host using module_repos_collection_with_setup.setup_virtual_machine
  • Install a fake custom package and then downgrade it to create applicable errata
  • Assert successful command execution for package install and downgrade steps
tests/foreman/ui/test_host.py
Explicitly register the no-profile and success hosts with appropriate options to drive warning and success status icons.
  • Register the no-profile host with the activation key but without additional package/repo setup to ensure missing package profile state
  • Register the success host with setup_insights disabled and remote execution enabled via register(..., setup_insights=False, setup_remote_execution=True)
tests/foreman/ui/test_host.py
Update UI assertions and test metadata to reflect dynamic recalculation and all three status states.
  • Reorder status checks to validate danger (errata host), warning (no-profile host), and success (registered RHEL host) including detailed status messages
  • Enhance the success assertion with a more descriptive failure message including actual status and details
  • Update docstring steps, expected results, and :Verifies: tag to match the new behavior and covered requirements
tests/foreman/ui/test_host.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@LadislavVasina1 LadislavVasina1 changed the title updateAllHostsStatusIconCheckTest Update test_positive_all_hosts_check_status_icon May 12, 2026
@LadislavVasina1 LadislavVasina1 marked this pull request as ready for review May 29, 2026 07:06
@LadislavVasina1 LadislavVasina1 requested a review from a team as a code owner May 29, 2026 07:06
Copy link
Copy Markdown
Contributor

@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 - I've reviewed your changes and they look great!


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.

@LadislavVasina1
Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py -k 'test_positive_all_hosts_check_status_icon'
theforeman:
    foreman: 10993

@Satellite-QE
Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 15660
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_host.py -k test_positive_all_hosts_check_status_icon --external-logging
Test Result : ========== 1 failed, 97 deselected, 5 warnings in 1685.38s (0:28:05) ===========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label May 29, 2026
@LadislavVasina1
Copy link
Copy Markdown
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_host.py -k 'test_positive_all_hosts_check_status_icon'
theforeman:
    foreman: 10993

@Satellite-QE
Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 15663
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_host.py -k test_positive_all_hosts_check_status_icon --external-logging
Test Result : ========== 1 passed, 97 deselected, 5 warnings in 1755.28s (0:29:15) ===========

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels May 29, 2026
Copy link
Copy Markdown
Contributor

@synkd synkd left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for adding coverage for my change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.19.z AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR Stream Introduced in or relating directly to Satellite Stream/Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants