Skip to content

test: reset hostname after ipa test#281

Merged
richm merged 1 commit into
linux-system-roles:mainfrom
richm:test-ipa-reset-hostname
Aug 13, 2025
Merged

test: reset hostname after ipa test#281
richm merged 1 commit into
linux-system-roles:mainfrom
richm:test-ipa-reset-hostname

Conversation

@richm
Copy link
Copy Markdown
Collaborator

@richm richm commented Aug 13, 2025

The tests_basic_ipa.yml test has to set a hostname for IPA
to work. We need to reset the hostname after the test.

Signed-off-by: Rich Megginson rmeggins@redhat.com

Summary by Sourcery

Save the original hostname before setting the IPA test hostname and restore it after the tests on RedHat systems

Enhancements:

  • Record the current hostname before changing it for the IPA test
  • Add a teardown task to reset the hostname to its original value after the test

The tests_basic_ipa.yml test has to set a hostname for IPA
to work.  We need to reset the hostname after the test.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Aug 13, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Preserve and restore the system hostname around the IPA test by capturing it before setup and resetting it afterward.

File-Level Changes

Change Details Files
Capture the original hostname before modifying it for the IPA test
  • Add task to retrieve current hostname via command
  • Register hostname output in __saved_hostname
  • Ensure the task does not mark changes
tests/tasks/setup_ipa.yml
Restore the original hostname after the IPA test
  • Add Reset hostname task in tests_basic_ipa.yml
  • Use systemd method and apply only on RedHat
  • Set hostname to value from __saved_hostname.stdout
tests/tests_basic_ipa.yml

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

Copy link
Copy Markdown

@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 @richm - 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.

@richm
Copy link
Copy Markdown
Collaborator Author

richm commented Aug 13, 2025

[citest]

@richm richm merged commit 5498449 into linux-system-roles:main Aug 13, 2025
34 checks passed
@richm richm deleted the test-ipa-reset-hostname branch August 13, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants