- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 584
chore(couchbase|etcd|firestore|mcpgateway|eventhubs|servicebus): apply consistent pattern for options #3447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(couchbase|etcd|firestore|mcpgateway|eventhubs|servicebus): apply consistent pattern for options #3447
Conversation
| ✅ Deploy Preview for testcontainers-go ready!
 To edit notification comments on pull requests, go to your Netlify project configuration. | 
| Summary by CodeRabbit
 WalkthroughRefactors multiple module Run functions to apply options/settings before constructing default module options, then append user customizations and invoke Run. Adjusts control flow in Azure Event Hubs/Service Bus, Couchbase, Docker MCP Gateway, etcd, and GCloud Firestore without altering public APIs. Changes
 Sequence Diagram(s)sequenceDiagram
  autonumber
  actor Caller
  participant RunFn as Module.Run
  participant Opts as Option(s)
  participant Settings as Settings/Config
  participant ModuleOpts as moduleOpts
  participant Runtime as testcontainers.Run
  Caller->>RunFn: Invoke Run(ctx, ..., opts...)
  RunFn->>Opts: Apply each Option (mutate default settings)
  alt Option error
    Opts-->>RunFn: error
    RunFn-->>Caller: return error
  else Options ok
    Opts-->>Settings: Populate settings
    RunFn->>ModuleOpts: Build defaults (ports, wait, CMD)
    RunFn->>ModuleOpts: Append user opts
    RunFn->>Runtime: Run(ctx, image, ModuleOpts...)
    Runtime-->>RunFn: Container / error
    RunFn-->>Caller: Return result
  end
sequenceDiagram
  autonumber
  actor Caller
  participant RunETCD as etcd.Run
  participant Opts as ContainerCustomizer(s)
  participant Cluster as configureCluster
  participant ModuleOpts as moduleOpts
  participant Runtime as testcontainers.Run
  Caller->>RunETCD: Run(ctx, nodes, opts...)
  RunETCD->>Opts: Apply to settings
  alt Option error
    RunETCD-->>Caller: error
  else
    RunETCD->>Cluster: Prepare network + per-node opts
    Cluster-->>RunETCD: cluster options
    RunETCD->>ModuleOpts: Build defaults + hooks
    RunETCD->>ModuleOpts: Append cluster opts + user opts
    RunETCD->>Runtime: Run(...)
    Runtime-->>RunETCD: Container(s)
    RunETCD-->>Caller: Return
  end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
 Suggested reviewers
 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)
 🚧 Files skipped from review as they are similar to previous changes (1)
 ⏰ 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). (9)
 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  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️  Outside diff range comments (1)
modules/couchbase/couchbase.go (1)
95-101: Fix contradictory password validation message.The guard enforces passwords of length ≥6, but the error reads “at most 6,” which is misleading for users hitting this validation.
- return nil, errors.New("admin password must be at most 6 characters long") + return nil, errors.New("admin password must be at least 6 characters long")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
- modules/azure/eventhubs/eventhubs.go(2 hunks)
- modules/azure/servicebus/servicebus.go(1 hunks)
- modules/couchbase/couchbase.go(2 hunks)
- modules/dockermcpgateway/dockermcpgateway.go(3 hunks)
- modules/etcd/etcd.go(2 hunks)
- modules/gcloud/firestore/firestore.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
modules/azure/eventhubs/eventhubs.go (4)
options.go (3)
ContainerCustomizer(22-24)
WithExposedPorts(454-459)
WithWaitStrategy(366-368)wait/all.go (1)
ForAll(44-48)wait/host_port.go (1)
ForListeningPort(67-69)wait/http.go (1)
ForHTTP(149-151)
modules/azure/servicebus/servicebus.go (2)
modules/azure/servicebus/options.go (1)
Option(30-30)modules/azure/eventhubs/eventhubs.go (1)
Container(31-34)
modules/etcd/etcd.go (1)
options.go (2)
ContainerCustomizer(22-24)
WithExposedPorts(454-459)
modules/gcloud/firestore/firestore.go (4)
options.go (4)
ContainerCustomizer(22-24)
WithExposedPorts(454-459)
WithWaitStrategy(366-368)
WithCmd(462-467)wait/all.go (1)
ForAll(44-48)wait/host_port.go (1)
ForListeningPort(67-69)wait/log.go (1)
ForLog(118-120)
modules/dockermcpgateway/dockermcpgateway.go (4)
options.go (4)
ContainerCustomizer(22-24)
WithExposedPorts(454-459)
WithHostConfigModifier(88-94)
WithWaitStrategy(366-368)wait/all.go (1)
ForAll(44-48)wait/host_port.go (1)
ForListeningPort(67-69)wait/log.go (1)
ForLog(118-120)
modules/couchbase/couchbase.go (1)
options.go (2)
ContainerCustomizer(22-24)
WithExposedPorts(454-459)
⏰ 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). (11)
- GitHub Check: test (1.25.x, modules/gcloud) / test: modules/gcloud/1.25.x
- GitHub Check: test (1.24.x, modules/azure) / test: modules/azure/1.24.x
- GitHub Check: test (1.25.x, modules/etcd) / test: modules/etcd/1.25.x
- GitHub Check: test (1.24.x, modules/gcloud) / test: modules/gcloud/1.24.x
- GitHub Check: test (1.24.x, modules/dockermcpgateway) / test: modules/dockermcpgateway/1.24.x
- GitHub Check: test (1.25.x, modules/couchbase) / test: modules/couchbase/1.25.x
- GitHub Check: test (1.24.x, modules/couchbase) / test: modules/couchbase/1.24.x
- GitHub Check: test (1.25.x, modules/dockermcpgateway) / test: modules/dockermcpgateway/1.25.x
- GitHub Check: test (1.25.x, modules/azure) / test: modules/azure/1.25.x
- GitHub Check: test (1.24.x, modules/etcd) / test: modules/etcd/1.24.x
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
modules/dockermcpgateway/dockermcpgateway.go (2)
30-38: LGTM! Settings extraction pattern improves consistency.Extracting settings from custom options before constructing moduleOpts is a cleaner pattern that allows the module to use settings for building commands and handling secrets before finalizing container configuration.
48-60: LGTM! Default module options construction is correct.The moduleOpts are properly constructed with sensible defaults:
- Port exposure for the gateway
- Docker socket binding for container access
- Appropriate wait strategies (port listening + log pattern)
What does this PR do?
It applies consistency in the definition of the module options.
Why is it important?
Consistency in the patterns discovered during the previous refactors.
Related issues