Skip to content

fix(test): only clean up containers created by image tests#51

Merged
alicefr merged 1 commit into
bootc-dev:mainfrom
zdyxry:fix-test
Jun 9, 2026
Merged

fix(test): only clean up containers created by image tests#51
alicefr merged 1 commit into
bootc-dev:mainfrom
zdyxry:fix-test

Conversation

@zdyxry

@zdyxry zdyxry commented Jun 6, 2026

Copy link
Copy Markdown
Contributor
  • Restrict container cleanup to test-owned ones (cluster-images-populator-* and test-images-verify)
  • Extract verify container name as a constant
  • Export PopulatorContainerNamePrefix for reuse in tests

Summary by Sourcery

Limit image integration test container cleanup to test-owned containers and expose shared container naming for reuse.

Bug Fixes:

  • Restrict integration test cleanup to only remove containers created by the image tests, avoiding deletion of user containers.

Enhancements:

  • Export PopulatorContainerNamePrefix for reuse and consistency in container naming.

Tests:

  • Introduce a shared constant for the image verification container name and update tests to use it.

@sourcery-ai

sourcery-ai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Restricts integration test container cleanup to only test-owned containers and exports the populator container name prefix for reuse, while centralizing the verify-container name into a constant.

File-Level Changes

Change Details Files
Limit container cleanup in integration tests to containers created by the test suite.
  • Wrap the container stop/remove loop with a filter that only matches containers with the cluster images populator prefix or the verify container name
  • Add a comment clarifying that user containers must not be touched during test cleanup
test/integration/images_test.go
Centralize the verify container name into a reusable constant in the images integration test.
  • Introduce a verifyContainerName constant for the verify container
  • Replace hard-coded "test-images-verify" string usages with verifyContainerName in container creation, exec, and AfterEach cleanup
test/integration/images_test.go
Export the populator container name prefix for reuse in tests and adjust the name construction helper.
  • Rename populatorContainerNamePrefix to exported PopulatorContainerNamePrefix
  • Update PopulatorContainerName to build container names using PopulatorContainerNamePrefix
internal/cluster/images.go
test/integration/images_test.go

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

Choose a reason for hiding this comment

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

Hey - 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.

Comment thread test/integration/images_test.go Outdated
_ = podmanClient.ContainerRemove(ctx, name, true)
// Only remove containers created by this test suite,
// never touch user containers.
if strings.HasPrefix(name, cluster.PopulatorContainerNamePrefix+"-") || name == verifyContainerName {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Many thanks for the fix. Any chance to relay in labels instead of the container name? We can also add a label for the populator if it is missing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, I've refactored the logic to rely on labels instead.

@alicefr

alicefr commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR the changes look good. Unfortunately, there is an issue with the CI I'm currently looking and trying to solve

@alicefr

alicefr commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

can you please rebase?

@alicefr

alicefr commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

@zdyxry could you also please squash the 2 commit into a single one?

- Add bink.component label to cluster-images-populator containers
- Add bink.component label to cluster-images-test-verify containers
- Filter test-owned containers by label in BeforeEach/AfterEach
- Unexport PopulatorContainerNamePrefix (no longer needed by tests)
@zdyxry

zdyxry commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@alicefr Hi, I've rebased and squash commit, wait for the CI results.

@alicefr alicefr merged commit c8065bc into bootc-dev:main Jun 9, 2026
6 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