Skip to content

[6.19.z] Use Convert2RHEL repofiles instead of deprecated repos for tests - #20890

Merged
Gauravtalreja1 merged 1 commit into
6.19.zfrom
cherry-pick-6.19.z-0644d11f807200c8014d37d1ac667fccd0952529
Feb 26, 2026
Merged

[6.19.z] Use Convert2RHEL repofiles instead of deprecated repos for tests#20890
Gauravtalreja1 merged 1 commit into
6.19.zfrom
cherry-pick-6.19.z-0644d11f807200c8014d37d1ac667fccd0952529

Conversation

@Satellite-QE

@Satellite-QE Satellite-QE commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

Cherrypick of PR: #20869

Problem Statement

Solution

Related Issues

Summary by Sourcery

Switch tests to use Convert2RHEL .repo files to derive repository base URLs instead of hard-coded deprecated repository URLs.

New Features:

  • Add a helper to extract a baseurl from a remote yum .repo file for reuse in tests.

Enhancements:

  • Update Convert2RHEL API tests to consume repository base URLs from configurable .repo files obtained via settings.

)

Signed-off-by: Gaurav Talreja <gtalreja@redhat.com>
(cherry picked from commit 0644d11)
@Satellite-QE Satellite-QE added 6.19.z Auto_Cherry_Picked Automatically cherrypicked PR using GHA No-CherryPick PR doesnt need CherryPick to previous branches labels Feb 26, 2026
@Satellite-QE

Copy link
Copy Markdown
Collaborator Author
trigger: test-robottelo
pytest: tests/foreman/api/test_convert2rhel.py
env:
     ROBOTTELO_REPOS__CONVERT2RHEL__CONVERT_TO_RHEL_REPOFILE: https://cdn-public.redhat.com/content/public/repofiles/convert2rhel-for-rhel-{}-x86_64.repo

@Satellite-QE Satellite-QE added the AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing label Feb 26, 2026
@sourcery-ai

sourcery-ai Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduce a helper to derive repository base URLs from remote .repo files and update Convert2RHEL CentOS/Oracle API tests to use this helper and new repofile-based settings instead of deprecated direct repository URLs.

Sequence diagram for get_baseurl_by_repofile usage in Convert2RHEL API tests

sequenceDiagram
    actor Tester
    participant TestConvert2RHEL
    participant content_info
    participant requests
    participant RepoServer

    Tester->>TestConvert2RHEL: run API test
    TestConvert2RHEL->>content_info: get_baseurl_by_repofile(repo_url, verify_ssl)
    content_info->>requests: get(repo_url, verify=verify_ssl, timeout=10)
    requests->>RepoServer: HTTP GET repo_url
    RepoServer-->>requests: 200 OK, .repo file
    requests-->>content_info: Response(text)
    content_info->>content_info: parse lines for baseurl=
    alt baseurl found
        content_info-->>TestConvert2RHEL: baseurl string
        TestConvert2RHEL->>TestConvert2RHEL: use baseurl in Convert2RHEL repo config
    else baseurl not found
        content_info-->>TestConvert2RHEL: raise ValueError
    end
    opt HTTP error
        requests-->>content_info: raise HTTPError
        content_info-->>TestConvert2RHEL: propagate HTTPError
    end
Loading

File-Level Changes

Change Details Files
Add utility to extract a baseurl from a remote yum .repo file.
  • Implement get_baseurl_by_repofile that downloads a .repo file via HTTP(S) with timeout and SSL verification options.
  • Parse the .repo file content line-by-line to locate and return the first baseurl entry.
  • Raise HTTPError on inaccessible URLs and ValueError when no baseurl is found.
robottelo/content_info.py
Refactor Convert2RHEL API tests to derive repository URLs from repofile settings via the new helper.
  • Replace use of convert_to_rhel_repo setting with convert_to_rhel_repofile for both CentOS and Oracle tests.
  • Use get_baseurl_by_repofile to resolve the actual repo base URL from the configured repofile URL before repository creation.
  • Keep the remaining test flow (host prep, repo creation, CV update) unchanged.
tests/foreman/api/test_convert2rhel.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:

  • In get_baseurl_by_repofile, consider skipping commented lines and using a more robust parser (e.g., configparser for INI-style files) so you don’t accidentally pick up baseurl in comments or miss values in specific sections.
  • The hardcoded timeout value in get_baseurl_by_repofile makes it harder to tune behavior for different environments; consider exposing it as a parameter or a module-level constant.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `get_baseurl_by_repofile`, consider skipping commented lines and using a more robust parser (e.g., `configparser` for INI-style files) so you don’t accidentally pick up `baseurl` in comments or miss values in specific sections.
- The hardcoded timeout value in `get_baseurl_by_repofile` makes it harder to tune behavior for different environments; consider exposing it as a parameter or a module-level constant.

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
Copy Markdown
Collaborator Author

PRT Result

Build Number: 14496
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_convert2rhel.py --external-logging
Test Result : =========== 1 failed, 3 passed, 275 warnings in 13540.60s (3:45:40) ============

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Feb 26, 2026
@Gauravtalreja1
Gauravtalreja1 merged commit 5e8b554 into 6.19.z Feb 26, 2026
16 of 20 checks passed
@Gauravtalreja1
Gauravtalreja1 deleted the cherry-pick-6.19.z-0644d11f807200c8014d37d1ac667fccd0952529 branch February 26, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.19.z 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-Failed Indicates that latest PRT run is failed for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants