Skip to content

Consolidate docs snippets with runnable examples and fix broken mockserver snippet - #12105

Open
Yusuf-Hussien wants to merge 1 commit into
testcontainers:mainfrom
Yusuf-Hussien:1167-docs-examples-consolidation
Open

Yusuf-Hussien wants to merge 1 commit into
testcontainers:mainfrom
Yusuf-Hussien:1167-docs-examples-consolidation

Conversation

@Yusuf-Hussien

@Yusuf-Hussien Yusuf-Hussien commented Oct 7, 2026 •

Copy link
Copy Markdown

Part of #1167

First batch of consolidation between the docs and the examples/ folder: improve discoverability and replace hand-typed snippets with codeincludes of runnable code.

Discoverability

  • Added the missing examples/ollama-hugging-face entry to docs/examples.md (16 projects existed, only 15 were listed)
  • Added links from module/feature pages to their matching runnable examples:
    • docs/modules/kafka.md → examples/kafka-cluster (multi-broker setup not covered by the page)
    • docs/modules/solr.md → examples/solr-container
    • docs/modules/databases/neo4j.md → examples/neo4j-container
    • docs/modules/ollama.md → examples/ollama-hugging-face
    • docs/modules/webdriver_containers.md → examples/selenium-container
    • docs/test_framework_integration/manual_lifecycle_control.md → examples/singleton-container

Snippet deduplication (inline → codeinclude)

  • docs/test_framework_integration/junit_4.md: the @Rule example is now embedded from docs/examples/junit4/redis/src/test/java/quickstart/RedisBackedCacheIntTest.java (inside_block:rule) instead of being hand-typed
  • docs/test_framework_integration/manual_lifecycle_control.md: the singleton pattern is now embedded from examples/singleton-container/src/test/java/com/example/AbstractIntegrationTest.java (block:AbstractIntegrationTest), which is built in CI, instead of a duplicated inline copy

Broken snippet fix

  • docs/modules/mockserver.md references inside_block:testSimpleExpectation, but that token did not exist in MockServerContainerTest, so the "setting a simple expectation" snippet has not been rendering at all. Added the // testSimpleExpectation { ... // } marker around the corresponding lines (same marker style as the existing creatingProxy marker in that file).

Verification

  • mkdocs build (per docs/contributing_docs.md) succeeds locally
  • Generated HTML checked for every touched page: all new codeincludes render their target blocks, all new links are present, and the mockserver expectation snippet now renders

Possible follow-ups (not included here)

  • docs/examples/junit4/generic and docs/examples/junit4/redis are not listed in settings.gradle, so most docs snippet sources are not compile-checked
  • docs/examples/junit4/generic/.../ContainerCreationTest.java defines snippet markers that no page uses

Summary by CodeRabbit

  • Documentation
    • Added links to runnable examples for Ollama with Hugging Face, Neo4j, Kafka, Solr, and Selenium containers.
    • Updated the JUnit 4 and manual lifecycle control guides to use examples from complete integration test sources, with a link to the singleton-container example.
  • Tests
    • Added markers around an existing MockServer expectation example; test behavior is unchanged.

…erver snippet

Add missing ollama-hugging-face entry to docs/examples.md, link module docs pages to matching examples/ projects, replace hand-typed inline snippets with codeincludes of runnable code, and restore the missing testSimpleExpectation marker so the mockserver docs snippet renders again.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a17e3bcc-a875-428f-ba43-8a22dc361b3e
📥 Commits

Reviewing files that changed from the base of the PR and between 9bb3c2d and aa3e11b.

📒 Files selected for processing (9)
  • docs/examples.md
  • docs/modules/databases/neo4j.md
  • docs/modules/kafka.md
  • docs/modules/ollama.md
  • docs/modules/solr.md
  • docs/modules/webdriver_containers.md
  • docs/test_framework_integration/junit_4.md
  • docs/test_framework_integration/manual_lifecycle_control.md
  • modules/mockserver/src/test/java/org/testcontainers/mockserver/MockServerContainerTest.java

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


📝 Walkthrough

Walkthrough

The documentation adds links to runnable examples and replaces two inline integration examples with source includes. Marker comments were added around an existing MockServer expectation; its executable behavior is unchanged.

Changes

Example documentation

Layer / File(s) Summary
Runnable example links
docs/examples.md, docs/modules/databases/neo4j.md, docs/modules/kafka.md, docs/modules/ollama.md, docs/modules/solr.md, docs/modules/webdriver_containers.md
Added links to runnable examples in the examples index and module documentation.
Integration examples and source markers
docs/test_framework_integration/junit_4.md, docs/test_framework_integration/manual_lifecycle_control.md, modules/mockserver/src/test/java/org/testcontainers/mockserver/MockServerContainerTest.java
Replaced two inline examples with source includes, added a link to a singleton-container example, and added marker comments around an existing MockServer expectation.

Priority: ⬇️ Low

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

Change: Other

Suggested reviewers: eddumelendez

Merge Risk: ⚪ Minimal · up to aa3e1

The documentation references and snippets align with their example sources; no concrete issue remains that should block merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (8 skipped: 8 … 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 summarizes the main changes: consolidating documentation snippets with runnable examples and fixing a broken MockServer snippet.
Description check ✅ Passed The description explains the changes and their context, references issue #1167, describes the broken snippet and its fix, and reports verification. It also notes relevant follow-up limitations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (8 skipped: 8 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant