chore(clickhouse|k6|localstack|redpanda|registry|socat): use Run in tests by mdelapenya · Pull Request #3432 · testcontainers/testcontainers-go
Warning
Rate limit exceeded
@mdelapenya has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 43 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.
We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
📒 Files selected for processing (1)
modules/clickhouse/clickhouse_test.go(1 hunks)
Summary by CodeRabbit
- New Features
- None
- Refactor
- Simplified container startup across modules by adopting a streamlined run API in tests and examples.
- Tests
- Updated integration tests for ClickHouse, Localstack, Redpanda, Registry, and Socat to use the new container run approach with consistent waiting and networking.
- Documentation
- Refreshed example tests to demonstrate the updated, concise container usage.
- Chores
- Improved consistency and readability in test setup and teardown without altering user-facing behavior.
Walkthrough
Replaces testcontainers.GenericContainer/ContainerRequest calls across module tests with testcontainers.Run and functional options, updating ports, wait strategies, networking, env, entrypoint/cmd and Dockerfile builds; test control flow, assertions, and cleanup remain unchanged.
Changes
| Cohort / File(s) | Summary |
|---|---|
Simple Run migrationmodules/clickhouse/clickhouse_test.go, modules/k6/examples_test.go |
Switches to testcontainers.Run with WithExposedPorts and WithWaitStrategy replacing manual GenericContainer setup; maintains existing startup/cleanup flow. |
Networking, entrypoint, cmd via optionsmodules/localstack/localstack_test.go, modules/redpanda/redpanda_test.go, modules/socat/socat_test.go |
Converts GenericContainerRequest to Run with option setters: network.WithNetwork, WithEntrypoint, WithCmd, WithEnv, and WithWaitStrategy (including wait.ForExec(...) in Localstack). Cleanup and assertions unchanged. |
Dockerfile build and registry flowsmodules/registry/examples_test.go, modules/registry/registry_test.go |
Replaces build/run via GenericContainer with Run("", WithDockerfile(...), WithAlwaysPull(), WithExposedPorts("6379/tcp"), WithWaitStrategy(...)). Adds explicit Repo/Tag in build-and-push scenarios; reuses tagged image via Run(taggedImage, ...). |
Socat examples networkingmodules/socat/examples_test.go |
Refactors examples to Run(image, WithExposedPorts(...), network.WithNetwork(...)), removing explicit ContainerRequest with networks/aliases; preserves termination and HTTP checks. |
Sequence Diagram(s)
sequenceDiagram
autonumber
participant T as Test
participant Run as testcontainers.Run
participant Docker as Docker Engine
participant Wait as WaitStrategy
T->>Run: Run(ctx, image, options...)
Run->>Docker: Create & start container (ports, env, entrypoint/cmd, network)
Run->>Wait: Apply wait strategy (log/port/exec)
Wait-->>Run: Ready / error
Run-->>T: Container handle or error
T->>Run: Cleanup/Terminate (defer)
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
- chore(clickhouse): use Run function #3325 — Migrates ClickHouse/Zookeeper to the Run API, overlapping with ClickHouse test changes here.
- chore(registry): use Run function #3431 — Updates the registry module/tests to use Run and Dockerfile options, matching this PR’s registry refactor.
- chore(socat): use Run function #3312 — Refactors the socat module to Run-based container startup, aligning with the socat changes in this PR.
Suggested reviewers
- stevenh
Poem
I hopped to Run and left old glue,
Ports set, waits in order too.
Networks, env, and CMD in place,
Containers hum with cheerful grace.
A carrot-coded test-time race 🥕🐇
Pre-merge checks and finishing touches
❌ 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%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title Check | ✅ Passed | The title succinctly identifies all six affected modules and clearly conveys the primary change of migrating their tests to use the Run function, directly matching the diffs and summary of the PR. It avoids unnecessary detail while remaining specific enough for a teammate to understand the scope. The phrasing aligns with conventional chore commit styles and accurately reflects the changeset. |
| Description Check | ✅ Passed | The description lists the exact modules updated and explains that the PR migrates their tests to the Run API, matching the raw summary and objectives. It also provides rationale by linking to the related issue and explaining why the change is important. This makes the description directly on-topic and informative. |
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.
Comment @coderabbitai help to get the list of available commands and usage tips.