Skip to content

reproducer for SAT-35949#21605

Draft
pondrejk wants to merge 1 commit into
SatelliteQE:masterfrom
pondrejk:caps-repr
Draft

reproducer for SAT-35949#21605
pondrejk wants to merge 1 commit into
SatelliteQE:masterfrom
pondrejk:caps-repr

Conversation

@pondrejk
Copy link
Copy Markdown
Contributor

@pondrejk pondrejk commented May 19, 2026

Problem Statement

not to be merged!

Solution

This should help reproduce the issue for verification of theforeman/foreman#10952

  1. have a packit patched machine with changes from Fixes #39220 - Exclude host taxonomies that don't match the capsule t… theforeman/foreman#10952
  2. checkout this PR from your local robottelo setup
git fetch <remote> pull/<PR_ID>/head:<NEW_BRANCHNAME>
git checkout NEW_BRANCHNAME
  1. run the test against the packit machine
pytest tests/foreman/cli/test_remoteexecution.py -k capsule_mismatch
  1. Let the test execute up until the breakpoint. Then go the the satellite UI, check capsules under Any org/Any loc see the newly created capsule assigned to the custom org, try to edit taxonomies -- Default org/Default loc are there marked as used by a host
  2. after you release the breakpoint the capsule machine probably won't clean up itself, so you'll have to check it in via broker

Summary by Sourcery

Tests:

  • Introduce a remote execution pull provider test that updates capsule taxonomies and pauses execution to facilitate manual reproduction and verification of the capsule mismatch issue.

@pondrejk pondrejk requested a review from a team as a code owner May 19, 2026 08:14
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 19, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a dedicated pytest reproducer for SAT-35949 that updates a capsule’s taxonomies via the Capsule CLI and pauses execution with a breakpoint for manual UI verification of the capsule/organization/location mismatch behavior.

File-Level Changes

Change Details Files
Introduce a new remote execution test that updates capsule taxonomies and pauses for manual inspection to reproduce SAT-35949.
  • Add test_reproduce_capsule_mismatch to TestPullProviderRex using existing fixtures for org, location, target satellite, and configured MQTT capsule
  • Use the Capsule CLI update command to assign the MQTT capsule to the provided organization and location via organization-ids and location-ids
  • Insert a breakpoint() call at the end of the test to allow interactive debugging and UI-based verification before cleanup
tests/foreman/cli/test_remoteexecution.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

@pondrejk pondrejk marked this pull request as draft May 19, 2026 08:15
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 found 2 issues, and left some high level feedback:

  • The new test_reproduce_capsule_mismatch includes an unconditional breakpoint() which will halt automated test runs; if this needs to remain, gate it behind an environment flag or convert it to a skipped/xfail test to avoid blocking CI.
  • Consider marking this reproducer test with a specific marker (e.g. @pytest.mark.reproducer or similar) so it can be easily excluded from standard test runs and clearly identified as non-standard.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `test_reproduce_capsule_mismatch` includes an unconditional `breakpoint()` which will halt automated test runs; if this needs to remain, gate it behind an environment flag or convert it to a skipped/xfail test to avoid blocking CI.
- Consider marking this reproducer test with a specific marker (e.g. `@pytest.mark.reproducer` or similar) so it can be easily excluded from standard test runs and clearly identified as non-standard.

## Individual Comments

### Comment 1
<location path="tests/foreman/cli/test_remoteexecution.py" line_range="1214" />
<code_context>
 class TestPullProviderRex:
     """Tests related to remote execution via pull provider (mqtt)"""

+    def test_reproduce_capsule_mismatch(
+        self,
+        module_org,
</code_context>
<issue_to_address>
**suggestion (testing):** This test is a manual reproducer without assertions; consider marking it appropriately or turning it into a regression test.

Right now this only sets up state and pauses, so it doesn’t actually verify the bug or the fix in foreman/pull/10952. For long-term value, either mark it as a manual-only reproducer (e.g. `@pytest.mark.manual` or `pytest.skip("manual reproducer")`) or turn it into a true regression test that asserts the expected capsule/org/location behavior once the flow can be automated.

Suggested implementation:

```python
class TestPullProviderRex:
    """Tests related to remote execution via pull provider (mqtt)"""

    @pytest.mark.manual
    def test_reproduce_capsule_mismatch(
        self,
        module_org,
        smart_proxy_location,
        module_target_sat,
        module_capsule_configured_mqtt,
    ):
        """Manual reproducer: run custom template on host converted to mqtt"""

```

1. Ensure `pytest` is imported at the top of `tests/foreman/cli/test_remoteexecution.py` (e.g. `import pytest`) if it is not already.
2. If your project uses strict pytest markers, register the `manual` marker in `pytest.ini` (or the equivalent config) with something like:
   `markers = manual: tests that are intended as manual reproducers and not run in automated test suites`.
</issue_to_address>

### Comment 2
<location path="tests/foreman/cli/test_remoteexecution.py" line_range="1230" />
<code_context>
+                'location-ids': smart_proxy_location.id,
+            }
+        )
+        breakpoint()  # noqa
+
     @pytest.mark.upgrade
</code_context>
<issue_to_address>
**issue (bug_risk):** Unconditional `breakpoint()` will block automated test runs; gate or remove it.

This `breakpoint()` will hang CI and other automated test runs if the test is executed outside the narrow repro scenario. Please either remove it once the regression test is in place, or guard it behind an explicit flag (e.g. an env var or pytest option) so normal test runs are unaffected.
</issue_to_address>

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.

class TestPullProviderRex:
"""Tests related to remote execution via pull provider (mqtt)"""

def test_reproduce_capsule_mismatch(
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.

suggestion (testing): This test is a manual reproducer without assertions; consider marking it appropriately or turning it into a regression test.

Right now this only sets up state and pauses, so it doesn’t actually verify the bug or the fix in foreman/pull/10952. For long-term value, either mark it as a manual-only reproducer (e.g. @pytest.mark.manual or pytest.skip("manual reproducer")) or turn it into a true regression test that asserts the expected capsule/org/location behavior once the flow can be automated.

Suggested implementation:

class TestPullProviderRex:
    """Tests related to remote execution via pull provider (mqtt)"""

    @pytest.mark.manual
    def test_reproduce_capsule_mismatch(
        self,
        module_org,
        smart_proxy_location,
        module_target_sat,
        module_capsule_configured_mqtt,
    ):
        """Manual reproducer: run custom template on host converted to mqtt"""
  1. Ensure pytest is imported at the top of tests/foreman/cli/test_remoteexecution.py (e.g. import pytest) if it is not already.
  2. If your project uses strict pytest markers, register the manual marker in pytest.ini (or the equivalent config) with something like:
    markers = manual: tests that are intended as manual reproducers and not run in automated test suites.

'location-ids': smart_proxy_location.id,
}
)
breakpoint() # noqa
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.

issue (bug_risk): Unconditional breakpoint() will block automated test runs; gate or remove it.

This breakpoint() will hang CI and other automated test runs if the test is executed outside the narrow repro scenario. Please either remove it once the regression test is in place, or guard it behind an explicit flag (e.g. an env var or pytest option) so normal test runs are unaffected.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant