Skip to content

SAT-44548 coverage#22195

Merged
vsedmik merged 1 commit into
SatelliteQE:masterfrom
LadislavVasina1:SAT-44548-coverage
Jul 22, 2026
Merged

SAT-44548 coverage#22195
vsedmik merged 1 commit into
SatelliteQE:masterfrom
LadislavVasina1:SAT-44548-coverage

Conversation

@LadislavVasina1

@LadislavVasina1 LadislavVasina1 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem Statement

Bulk "Change Location" via "Select All" on the All Hosts page ignored the current location context and applied the change to all hosts across the Satellite, not just the ones visible in the selected location.

Solution

Added a UI test that verifies the fix from theforeman/foreman#11033.
The test creates hosts in two different locations, performs a bulk location change using "Select All" while scoped to one location, and asserts that only hosts from that location are moved while hosts in the other location remain unaffected.

PRT test Cases example

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

Summary by Sourcery

Tests:

  • Add a host UI test that verifies bulk 'Change Location' only moves hosts from the selected location while leaving hosts in other locations unchanged.

@LadislavVasina1 LadislavVasina1 self-assigned this Jul 21, 2026
@LadislavVasina1
LadislavVasina1 requested a review from a team as a code owner July 21, 2026 12:21
@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 Jul 21, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds a new UI test to validate that bulk 'Change Location' using 'Select All' on the All Hosts page respects the current location context, ensuring only hosts in the selected location are moved while others remain unchanged.

File-Level Changes

Change Details Files
Introduce an end-to-end UI test that verifies bulk location changes via 'Select All' affect only hosts scoped to the current location context.
  • Create organization and three locations and generate fake hosts in two of those locations using existing API/CLI factory helpers.
  • Scope the UI session to a specific organization and location, then perform a bulk location change via the All Hosts page using the Select All option.
  • Add cleanup logic via pytest finalizer to delete created hosts, locations, and the organization after the test completes.
  • Assert via API that hosts from the scoped location are moved to the new location while hosts from the other location remain in their original location.
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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The test currently assumes that search always returns a single host and indexes [0]; consider asserting the number of results (e.g., len(hosts) == 1) before indexing to make failures clearer and avoid hidden flakiness if extra hosts match the query.
  • Host creation for locations X and Y is duplicated; you could factor this into a small helper that creates N fake hosts for a given location and returns their names to reduce repetition and make the scenario setup easier to adjust.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The test currently assumes that `search` always returns a single host and indexes `[0]`; consider asserting the number of results (e.g., `len(hosts) == 1`) before indexing to make failures clearer and avoid hidden flakiness if extra hosts match the query.
- Host creation for locations X and Y is duplicated; you could factor this into a small helper that creates N fake hosts for a given location and returns their names to reduce repetition and make the scenario setup easier to adjust.

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_bulk_change_location_select_all_respects_context'
env:
    ROBOTTELO_server__version__release: 'stream'
    ROBOTTELO_server__version__snap: '199.0'
    ROBOTTELO_server__deploy_arguments__deploy_sat_version: 'stream'
    ROBOTTELO_server__deploy_arguments__deploy_snap_version: '199.0'

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16184
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_host.py -k test_positive_bulk_change_location_select_all_respects_context --external-logging
Test Result : ========== 1 passed, 98 deselected, 5 warnings in 1273.67s (0:21:13) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 21, 2026
@LadislavVasina1
LadislavVasina1 requested a review from vsedmik July 21, 2026 13:02

@jnagare-redhat jnagare-redhat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@vsedmik vsedmik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@vsedmik
vsedmik merged commit de607c0 into SatelliteQE:master Jul 22, 2026
14 checks passed
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