-
-
Notifications
You must be signed in to change notification settings - Fork 583
chore(vault): use Run function #3443
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(vault): use Run function #3443
Conversation
This commit migrates the vault 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 WithExposedPorts, WithHostConfigModifier, WithWaitStrategy, WithEnv - WithToken uses WithEnv for setting root token env vars - WithInitCommand uses WithAdditionalWaitStrategy to append exec wait Tests: 10 tests, 89.5% coverage Ref: testcontainers#3174 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary by CodeRabbit
WalkthroughRefactors Vault module to use testcontainers.Run with modular ContainerCustomizer options. Replaces direct ContainerRequest mutations for env, wait strategy, exposed ports, and host config. Updates error messages. Adjusts WithToken and WithInitCommand to return options (WithEnv, WithAdditionalWaitStrategy). Preserves CAP_IPC_LOCK via HostConfigModifier. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as Caller
participant V as vault.Run(...)
participant TC as testcontainers.Run
participant D as Docker Engine
U->>V: Run(ctx, img, opts...)
Note right of V: Build moduleOpts<br/>- WithExposedPorts<br/>- WithEnv<br/>- WithWaitStrategy<br/>- WithHostConfigModifier (CAP_IPC_LOCK)
V->>TC: Run(ctx, img, moduleOpts+opts)
TC->>D: Create & start container
alt start succeeds
D-->>TC: Container started
TC-->>V: Container handle
V-->>U: Return container
else error
D-->>TC: Error
TC-->>V: Error
V-->>U: wrap "run vault: %w"
end
rect rgba(230,245,255,0.5)
Note over U,V: Option hooks
U->>V: WithToken(token)
V-->>U: returns WithEnv("VAULT_TOKEN"=token)
U->>V: WithInitCommand(cmd)
V-->>U: returns WithAdditionalWaitStrategy(wait.ForExec(cmd))
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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/vault/vault.go (3)
🔇 Additional comments (6)
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 vault
Why is it important?
Migrate modules to the new API, improving consistency and leveraging the latest testcontainers functionality.
Related issues