Skip to content

containerztest: remove container during cleanup after stop - #5810

Open
prathapcv wants to merge 2 commits into
openconfig:mainfrom
prathapcv:fix/container-cleanup-remove-on-stop
Open

containerztest: remove container during cleanup after stop#5810
prathapcv wants to merge 2 commits into
openconfig:mainfrom
prathapcv:fix/container-cleanup-remove-on-stop

Conversation

@prathapcv

Copy link
Copy Markdown
Contributor

Summary

  • Fixes cleanup behavior in container helper teardown.

  • internal/containerztest/containerztest.go Stop() previously stopped containers but did not remove them.
    Problem

  • Residual container instances (for example cntr-test-conn created in cntr_test.go) could remain after tests.

  • This can cause cross-test interference such as container name/port conflicts in subsequent runs.
    Change

  • In internal/containerztest/containerztest.go, update Stop() to call RemoveContainer(ctx, instNameToStop, true) after StopContainer(...).

  • Handle NotFound gracefully to keep cleanup idempotent.

Impact

  • Applies to tests using containerztest.Setup() cleanup path (including container connectivity and lifecycle tests).
  • Improves teardown correctness and reduces stale-resource failures.

@prathapcv
prathapcv requested a review from a team as a code owner July 31, 2026 05:37
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 container test helper utility by ensuring that containers are fully removed from the environment during the teardown process. By addressing residual container instances, the change prevents potential naming or port conflicts between subsequent test runs, leading to more reliable and isolated test execution.

Highlights

  • Improved Cleanup Logic: Updated the Stop function in containerztest to explicitly remove containers after stopping them.
  • Idempotent Teardown: Added graceful handling for NotFound errors during container removal to ensure cleanup remains idempotent and prevents test interference.
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 the 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 counterproductive. 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.

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.

@OpenConfigBot

OpenConfigBot commented Jul 31, 2026

Copy link
Copy Markdown

Pull Request Functional Test Report for #5810 / 69c3d0b

No tests identified for validation.

Help

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds container removal logic to the Stop function in internal/containerztest/containerztest.go to clean up containers after they are stopped. The feedback suggests a minor improvement to use status.Code(err) directly for cleaner and more idiomatic gRPC error handling when checking for the NotFound status.

Comment thread internal/containerztest/containerztest.go
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