Skip to content

Conversation

@jwieleRH
Copy link
Contributor

@jwieleRH jwieleRH commented Dec 2, 2025

Simplify regular expression matching by ignoring some whitespace in the regular expression.

Coalesce internal whitespace and strip surrounding whitespace in the help string to make matching reliable in environments where the help string is split across lines.

Summary by Sourcery

Bug Fixes:

  • Fix flakiness in test_default_image by normalizing whitespace in the help message and default image fields before asserting.

Simplify regular expression matching by ignoring some whitespace in
the regular expression.

Coalesce internal whitespace and strip surrounding whitespace in the
help string to make matching reliable in environments where the help
string is split across lines.

Signed-off-by: John Wiele <[email protected]>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 2, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the default image help test regex and whitespace handling to make the test robust to line breaks and variable spacing in the help output.

File-Level Changes

Change Details Files
Relax the regex and normalize whitespace in test_default_image to make matching stable across environments.
  • Update DEFAULT_IMAGE_PATTERN to allow optional and flexible whitespace around the default image clause in the help text
  • Replace newline-stripping plus hardcoded whitespace translation with normalization of internal whitespace using split/join for the help message
  • Trim surrounding whitespace for the captured image and image_tag before assertions
  • Add an explicit assertion that the regex match succeeded before using captured groups
test/e2e/test_help.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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jwieleRH, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of an end-to-end test responsible for verifying the default image information displayed in the application's help output. The changes make the test more tolerant to minor formatting variations in the help string, ensuring it passes consistently across different environments where whitespace might be handled differently.

Highlights

  • Improved Regex for Help Output Parsing: The regular expression DEFAULT_IMAGE_PATTERN used to parse the --help output has been updated to be more resilient to variations in whitespace, specifically around the (default: keyword.
  • Robust Whitespace Handling in Test Assertions: The test_default_image function now explicitly coalesces internal whitespace and strips surrounding whitespace from the extracted help message, image, and image tag. This ensures more reliable matching, especially when the help string might be split across lines or have inconsistent spacing.
  • Simplified Whitespace Removal: The str.maketrans method previously used for whitespace removal in the image assertion has been replaced with simpler strip() and split()/join() operations, improving readability and maintainability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 there - 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to fix a flaky test by improving whitespace handling in a regular expression and associated assertions. The changes are a positive step towards making the test more robust. My review includes a suggestion to further enhance the regular expression to handle newlines more gracefully, which would simplify the test code. Additionally, I recommend applying the improved assertion logic consistently across other related tests to improve the overall reliability and maintainability of the test suite.

@rhatdan
Copy link
Member

rhatdan commented Dec 3, 2025

LGTM

@rhatdan rhatdan merged commit a8e3056 into containers:main Dec 3, 2025
24 of 28 checks passed
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