Skip to content

test: ensure bogus hostname lookups will fail with invalid hostname#494

Merged
richm merged 1 commit intolinux-system-roles:mainfrom
richm:test-use-host@domain
Mar 25, 2026
Merged

test: ensure bogus hostname lookups will fail with invalid hostname#494
richm merged 1 commit intolinux-system-roles:mainfrom
richm:test-use-host@domain

Conversation

@richm
Copy link
Copy Markdown
Collaborator

@richm richm commented Mar 24, 2026

Some of our test systems were configured with some sort of DNS fail safe
lookup which caused host.domain to resolve to 127.0.0.1, which caused
AVC issues. The fix is to ensure that the hostname lookup will fail
by using invalid characters in the hostname - host@domain is an
invalid hostname.

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

Summary by Sourcery

Tests:

  • Adjust forwarding-related tests to use an invalid hostname (host@domain) instead of a potentially resolvable host.domain to avoid environment-specific DNS behavior.

Some of our test systems were configured with some sort of DNS fail safe
lookup which caused `host.domain` to resolve to 127.0.0.1, which caused
AVC issues.  The fix is to ensure that the hostname lookup will fail
by using invalid characters in the hostname - host@domain is an
invalid hostname.

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

sourcery-ai bot commented Mar 24, 2026

Reviewer's Guide

Updates forwarding-related test cases to use an intentionally invalid hostname (host@domain) instead of a potentially resolvable one (host.domain), ensuring DNS lookups fail consistently across environments and avoiding unintended connections to localhost or other systems.

File-Level Changes

Change Details Files
Use an invalid hostname in forwarding tests to guarantee DNS lookup failure and avoid environment-dependent resolutions.
  • Replace all forwards target values from a valid-looking hostname to an invalid hostname in basics forwarding tests, including TCP, UDP, and TLS scenarios.
  • Update embedded rsyslog rulesets in the same tests so omfwd Target matches the invalid hostname used in the higher-level test definitions.
  • Propagate the same hostname change to combination tests, file+forward tests, and RELP-related tests to keep forwarding behavior consistent across the entire test suite.
tests/tests_basics_forwards.yml
tests/tests_combination.yml
tests/tests_basics_files.yml
tests/tests_relp.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 - I've left some high level feedback:

  • Since this bogus hostname string is repeated many times across test files, consider defining it once as a shared variable/fixture to make future updates easier and ensure consistency.
  • If the goal is specifically to guarantee DNS resolution failure rather than a syntax/validation error, you might want to use a syntactically valid but non-resolvable hostname (e.g. nonexistent.invalid) instead of introducing an invalid character like @, which may change where the failure occurs in the stack.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since this bogus hostname string is repeated many times across test files, consider defining it once as a shared variable/fixture to make future updates easier and ensure consistency.
- If the goal is specifically to guarantee DNS resolution failure rather than a syntax/validation error, you might want to use a syntactically valid but non-resolvable hostname (e.g. `nonexistent.invalid`) instead of introducing an invalid character like `@`, which may change where the failure occurs in the stack.

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 Mar 24, 2026

[citest]

@richm richm requested a review from spetrosi March 25, 2026 00:01
@richm richm merged commit 200da29 into linux-system-roles:main Mar 25, 2026
29 checks passed
@richm richm deleted the test-use-host@domain branch March 25, 2026 12:41
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