Skip to content

Conversation

@mabrarov
Copy link
Contributor

@mabrarov mabrarov commented Jan 8, 2026

Changes

  • fix(redpanda): closing provider in test after use

What does this PR do?

This PR fixes issue found in #3165.

Why is it important?

Proper resource management in test for redpanda module.

How to test this PR

Run tests for redpanda module, like:

go test -C modules/redpanda -count 1 -v ./...

@mabrarov mabrarov requested a review from a team as a code owner January 8, 2026 11:46
@netlify
Copy link

netlify bot commented Jan 8, 2026

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit ddfeb95
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-go/deploys/695f990c17556100083259c1
😎 Deploy Preview https://deploy-preview-3539--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

Summary by CodeRabbit

  • Tests
    • Improved resource cleanup in test infrastructure to ensure proper lifecycle management of test resources.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

A defer statement was added to close a provider resource in the containerHost function of the test file. The defer ensures cleanup occurs when the function returns while allowing the provider to remain available for subsequent operations.

Changes

Cohort / File(s) Summary
Resource Cleanup
modules/redpanda/redpanda_test.go
Added defer statement to close provider resource after it is obtained, ensuring proper lifecycle management

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A defer for cleanup, oh what a sight,
Resources released, held close and tight,
The provider closes, neat and clean,
The best housekeeping you've ever seen!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a deferred close for the provider in a redpanda test to fix a resource management issue.
Description check ✅ Passed The description is related to the changeset, explaining the purpose of closing the provider in the test and referencing the specific issue being addressed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b460ba6 and ddfeb95.

📒 Files selected for processing (1)
  • modules/redpanda/redpanda_test.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test (1.25.x, modules/redpanda) / test: modules/redpanda/1.25.x
  • GitHub Check: test (1.24.x, modules/redpanda) / test: modules/redpanda/1.24.x
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
modules/redpanda/redpanda_test.go (1)

806-807: LGTM! Proper resource cleanup added.

The defer p.Close() correctly ensures the provider is cleaned up when the function exits, addressing the resource management issue referenced in the PR objectives. The provider is only needed to extract the daemon host information, so closing it immediately after use is appropriate.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdelapenya mdelapenya merged commit 72929c8 into testcontainers:main Jan 8, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue with the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants