Skip to content

Add log level test for foreman and proxy#22148

Open
shubhamsg199 wants to merge 1 commit into
SatelliteQE:masterfrom
shubhamsg199:add_foreman_log_test
Open

Add log level test for foreman and proxy#22148
shubhamsg199 wants to merge 1 commit into
SatelliteQE:masterfrom
shubhamsg199:add_foreman_log_test

Conversation

@shubhamsg199

@shubhamsg199 shubhamsg199 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Adding foremanctl log level management tests for foreman and foreman-proxy

Summary by Sourcery

Tests:

  • Introduce a new foremanctl log level test that validates parameter persistence, debug logging for Foreman and Proxy, and parameter reset behavior.

Signed-off-by: Shubham Ganar <shubhamsg123m@gmail.com>
@shubhamsg199 shubhamsg199 self-assigned this Jul 15, 2026
@shubhamsg199 shubhamsg199 requested a review from a team as a code owner July 15, 2026 14:25
@shubhamsg199 shubhamsg199 added No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master labels Jul 15, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds an end-to-end foremanctl log level management test that validates setting and resetting log levels for Foreman and Proxy services, including persistence in the parameters file and debug output in system journals.

File-Level Changes

Change Details Files
Add an e2e test that verifies foremanctl deploy log level parameters for Foreman and Proxy, their persistence, debug journal output, and proper reset behavior.
  • Import the FOREMANCTL_PARAMETERS_FILE constant used to locate the foremanctl parameters YAML.
  • Implement test_positive_foremanctl_log_level marked with pytest.mark.foremanctl using module_target_sat to run foremanctl deploy with specific log level parameters.
  • Assert that foremanctl deploy completes successfully and that the three log level parameters are persisted as 'debug' in the parameters YAML.
  • Trigger Foreman activity via hammer and assert presence of DEBUG-level [D
...] entries in the foreman.service journal.
  • Trigger Proxy activity via hammer and assert presence of DEBUG-level [D] entries in the foreman-proxy.service journal.
  • Run foremanctl deploy with reset flags for all log level parameters and assert success.
  • Reload the parameters YAML and assert that all log level keys are absent after reset.

  • 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 params object from load_remote_yaml_file is treated both as having attributes (e.g. params.foreman_log_level) and as a mapping (e.g. params.get(...)); consider using a single consistent access pattern (likely dict-style) to avoid runtime errors.
    • The grep pattern "\[D|" in the foreman journal check looks suspicious, as [ starts a character class and | is not alternation in grep; if you intend to match the literal sequence [D| or [D|...], adjust the escaping or pattern (e.g. "\[D\|" or a more precise regex).
    Prompt for AI Agents
    Please address the comments from this code review:
    
    ## Overall Comments
    - The `params` object from `load_remote_yaml_file` is treated both as having attributes (e.g. `params.foreman_log_level`) and as a mapping (e.g. `params.get(...)`); consider using a single consistent access pattern (likely dict-style) to avoid runtime errors.
    - The grep pattern `"\[D|"` in the foreman journal check looks suspicious, as `[` starts a character class and `|` is not alternation in grep; if you intend to match the literal sequence `[D|` or `[D|...]`, adjust the escaping or pattern (e.g. `"\[D\|"` or a more precise regex).

    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.

    @shubhamsg199

    Copy link
    Copy Markdown
    Contributor Author
    trigger: test-robottelo
    pytest: tests/foreman/cli/test_logging.py -k test_positive_foremanctl_log_level
    deployment_type: container
    theforeman:
        foremanctl: 640
    

    ' --add-feature hammer'
    ' --foreman-log-level=debug'
    ' --foreman-proxy-log-level=debug'
    ' --log-level=debug',

    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.

    since --log-level=debug sets foreman and proxy both log levels as debug. would it be better to provide diffrent values for --foreman-log-level and --foreman-proxy-log-level to a different value than debug? that way we also test that --foreman-log-level = something overides --log-level for foreman?

    @Satellite-QE

    Copy link
    Copy Markdown
    Collaborator

    PRT Result

    Build Number: 16134
    Build Status: UNSTABLE
    PRT Comment: pytest tests/foreman/cli/test_logging.py -k test_positive_foremanctl_log_level --external-logging
    Test Result : =========== 1 failed, 5 deselected, 5 warnings in 1915.04s (0:31:55) ===========
    

    @Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jul 15, 2026
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    No-CherryPick PR doesnt need CherryPick to previous branches PRT-Failed Indicates that latest PRT run is failed 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