Skip to content

fix: format MountType with %v in bind mount diagnostic - #3915

Open
vulragrag-star wants to merge 1 commit into
testcontainers:mainfrom
vulragrag-star:fix/3909-mounttype-format-verb
Open

vulragrag-star wants to merge 1 commit into
testcontainers:mainfrom
vulragrag-star:fix/3909-mounttype-format-verb

Conversation

@vulragrag-star

Copy link
Copy Markdown

What does this PR do?

In mapToDockerMounts, the BindMounter diagnostic used %s with MountType (a uint with no String method). That produces a fmt error marker such as %!s(testcontainers.MountType=0) instead of the type value. This changes the verb to %v and adds a unit test for the diagnostic format.

Why is it important?

Unsupported-bind-mount errors should show a readable mount type so the diagnostic is usable when debugging mount configuration.

Related issues

How to test this PR

go test -run TestMapToDockerMountsBindDiagnosticFormat .

BindMounter logging used %s with MountType (a uint), which produced a
fmt error marker instead of the type value. Use %v so the diagnostic is
readable.

Refs: testcontainers#3909
@vulragrag-star
vulragrag-star requested a review from a team as a code owner September 29, 2026 12:46
@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 57909de
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-go/deploys/6abbb30f429eb0000868e872
😎 Deploy Preview https://deploy-preview-3915--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

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fb7729cd-c652-4002-a1b1-3aafd677e9ca

📥 Commits

Reviewing files that changed from the base of the PR and between 096293a and 57909de.

📒 Files selected for processing (2)
  • docker_mounts.go
  • docker_mounts_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Summary by CodeRabbit

  • Bug Fixes
    • Corrected unsupported mount-type diagnostics so they display the mount type without a formatting error marker.

Walkthrough

The unsupported mount diagnostic now formats the mount type with %v instead of %s. A test captures the log output and checks that it contains no formatting error marker.

Changes

Mount Diagnostic Formatting

Layer / File(s) Summary
Diagnostic formatting and test
docker_mounts.go, docker_mounts_test.go
The diagnostic uses %v to format the mount type. The test captures the log output and checks that it has no formatting error marker. It restores the previous default logger during cleanup.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: mdelapenya

Merge Risk: ⚪ Minimal · up to 57909

The diagnostic formatting issue is addressed and covered by a focused test; no material merge risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: formatting MountType with %v in the bind-mount diagnostic.
Description check ✅ Passed The description directly explains the formatting defect, the code change, the added test, and the debugging benefit.
Linked Issues check ✅ Passed The PR meets the coding requirement in issue #3909. mapToDockerMounts changes the MountType diagnostic verb from %s to %v, which removes the fmt error marker and preserves the mount type val…
Out of Scope Changes check ✅ Passed The reported changes stay within issue #3909. They modify only the affected diagnostic format and add focused test coverage for that format. No unrelated mount behavior or public API change is reporte…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

A rabbit checks the mount log line,
The type now prints without a sign
Of formatting trouble in the stream,
A test confirms the output’s clean,
Then hops away to nibble greens.

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

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.

[Bug]: Unsupported mount diagnostic formats MountType with a string verb

1 participant