chore(yugabytedb): use Run function#3444
Conversation
This commit migrates the yugabytedb module to use the new testcontainers.Run() API. The main changes are: - Use testcontainers.Run() instead of testcontainers.GenericContainer() - Convert to moduleOpts pattern with functional options - Use WithCmd, WithWaitStrategy, WithExposedPorts, WithEnv - Use Inspect after Run to retrieve actual env var values after user customizations - Multiple wait strategies for logs and listening ports Tests: 9 tests, 93.0% coverage Ref: testcontainers#3174 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary by CodeRabbit
WalkthroughRefactors the YugabyteDB module to construct and start the container via testcontainers.Run with modular options, replaces manual ContainerRequest/GenericContainer usage, adds a post-start container inspect to read actual env values into fields, introduces targeted error messages, and includes early nil checks. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Caller
participant YB as YugabyteDB Module
participant TC as testcontainers.Run
participant Docker as Docker Engine
Dev->>YB: Run(ctx, req)
rect rgba(200,230,255,0.3)
note right of YB: Build moduleOpts (WithImage, WithCmd,<br/>WithExposedPorts, WithEnv, WithWait)
YB->>TC: Run(ctx, moduleOpts...)
TC->>Docker: Create+Start container
Docker-->>TC: Container handle
TC-->>YB: Container (c)
end
alt c == nil
YB-->>Dev: error("run yugabytedb: ...")
else Post-start inspect
YB->>Docker: Inspect container (env)
Docker-->>YB: Env key/values
note right of YB: Map inspected env to Container fields
YB-->>Dev: Container handle + populated fields
end
%% Error path on inspect
opt Inspect fails
YB-->>Dev: error("inspect yugabytedb: ...")
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)modules/yugabytedb/yugabytedb.go (3)
🔇 Additional comments (1)
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 |
What does this PR do?
Use the Run function in yugabytedb
Why is it important?
Migrate modules to the new API, improving consistency and leveraging the latest testcontainers functionality.
Related issues