-
-
Notifications
You must be signed in to change notification settings - Fork 586
feat(options): add WithProvider #3241
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
feat(options): add WithProvider #3241
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
d8a12e3 to
6e1e7fd
Compare
|
@dfioravanti thanks for this. I mentioned that we are working on the Docker SDK, so the concept of Provider will be automatically discarded with that (the SDK simply uses the current docker context to get a docker client), so the configuration would be much much easier, so I'd say that this PR won't be not needed. On the other hand, thanks to the functional options pattern, this new option is harmless, so it's fine for me adding it and let users of the library choose. Said that, could you please check if the podman docs are up-to-date with these changes? 🙏 |
6e1e7fd to
15549c6
Compare
|
@mdelapenya thanks for been open to merge this
I updated the documentation and added the option to the list of options. Does it work now? |
mdelapenya
left a 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.
Just a couple of refinements, other than that, LGTM
The generic container allows to set a provider for a container but this is not exposed via the options. This commit adds this capability so that it is possible to set the provider to Podman on MacOS when the auto detection fails
15549c6 to
3bb3f06
Compare
|
@mdelapenya I fixed the two problems, thanks for the review |
mdelapenya
left a 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.
LGTM, thanks!
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.
Pull Request Overview
This PR adds a new WithProvider option to allow users to explicitly specify which container provider (Docker or Podman) to use when creating containers. This addresses issues with provider auto-detection, particularly on MacOS where Podman detection fails and prevents Ryuk from working properly.
- Introduces
WithProviderfunction that accepts aProviderTypeparameter - Adds comprehensive test coverage for the new option with all supported provider types
- Updates documentation with MacOS-specific guidance for using Podman with Ryuk
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| options.go | Implements the new WithProvider function that sets the provider type on container requests |
| options_test.go | Adds comprehensive test coverage for the WithProvider option with all provider types |
| docs/system_requirements/using_podman.md | Documents MacOS-specific setup instructions for using Podman with Ryuk |
| docs/features/common_functional_options_list.md | Adds the new option to the options list with version information |
| docs/features/common_functional_options.md | Documents the WithProvider option with usage description |
Comments suppressed due to low confidence (1)
…util/v4-4.25.6 * main: fix(dockermcpgateway): use duckduckgo instead of brave (#3247) feat: add Solace pubsub+ module (#3230) feat(options): add WithProvider (#3241) chore(deps): bump github/codeql-action from 3.29.2 to 3.29.3 (#3237) chore(deps): bump golang.org/x/oauth2 in /modules/weaviate (#3240) chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (#3239) chore(deps): bump requests from 2.32.0 to 2.32.4 (#3204) feat(mcpgateway): add MCP gateway module (#3232) chore(deps): bump golang.org/x/oauth2 in /modules/pulsar (#3236) chore(deps): bump golang.org/x/oauth2 in /modules/gcloud (#3235) chore(deps): bump golang.org/x/oauth2 in /modules/k3s (#3234) chore: prepare for next minor development cycle (0.39.0) chore: use new version (v0.38.0) in modules and examples Update go.mod in azure module (#3231) fix: strip headers from logs using log stream specification (#3226) chore: clarify image auth warning message for public images (#3228) chore(deps): bump github.com/go-viper/mapstructure/v2 (#3219) chore(deps): bump github/codeql-action from 3.28.16 to 3.29.2 (#3222) chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (#3225)
* main: (33 commits) feat(registry): add helper functions to pull and tag images (testcontainers#3275) fix(reaper): remove termSignal override (testcontainers#3261) chore(deps): bump ryuk to v0.13.0, which uses scratch as base image (testcontainers#3274) chore(release): refine release script to update inter-module dependencies (testcontainers#3273) fix(registry): update `WithHtpasswd` to use `os.CreateTemp` instead of `os.Create` with `filepath.Join`. (testcontainers#3272) chore(deps): bump github.com/docker/docker from 28.2.2+incompatible to 28.3.3+incompatible (testcontainers#3270) chore(postgres): use require.NotNil instead of assert.NotNil (testcontainers#3252) fix(nats): use wait for listening port instead of wait for log (testcontainers#3256) chore(deps): bump github.com/go-viper/mapstructure/v2 (testcontainers#3267) fix(postgres): snapshot restore (testcontainers#3264) fix(dockermcpgateway): use duckduckgo instead of brave (testcontainers#3247) feat: add Solace pubsub+ module (testcontainers#3230) feat(options): add WithProvider (testcontainers#3241) chore(deps): bump github/codeql-action from 3.29.2 to 3.29.3 (testcontainers#3237) chore(deps): bump golang.org/x/oauth2 in /modules/weaviate (testcontainers#3240) chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (testcontainers#3239) chore(deps): bump requests from 2.32.0 to 2.32.4 (testcontainers#3204) feat(mcpgateway): add MCP gateway module (testcontainers#3232) chore(deps): bump golang.org/x/oauth2 in /modules/pulsar (testcontainers#3236) chore(deps): bump golang.org/x/oauth2 in /modules/gcloud (testcontainers#3235) ...
* main: (30 commits) fix: preserve unix socket schema in testcontainers host from properties (testcontainers#3213) feat(registry): add helper functions to pull and tag images (testcontainers#3275) fix(reaper): remove termSignal override (testcontainers#3261) chore(deps): bump ryuk to v0.13.0, which uses scratch as base image (testcontainers#3274) chore(release): refine release script to update inter-module dependencies (testcontainers#3273) fix(registry): update `WithHtpasswd` to use `os.CreateTemp` instead of `os.Create` with `filepath.Join`. (testcontainers#3272) chore(deps): bump github.com/docker/docker from 28.2.2+incompatible to 28.3.3+incompatible (testcontainers#3270) chore(postgres): use require.NotNil instead of assert.NotNil (testcontainers#3252) fix(nats): use wait for listening port instead of wait for log (testcontainers#3256) chore(deps): bump github.com/go-viper/mapstructure/v2 (testcontainers#3267) fix(postgres): snapshot restore (testcontainers#3264) fix(dockermcpgateway): use duckduckgo instead of brave (testcontainers#3247) feat: add Solace pubsub+ module (testcontainers#3230) feat(options): add WithProvider (testcontainers#3241) chore(deps): bump github/codeql-action from 3.29.2 to 3.29.3 (testcontainers#3237) chore(deps): bump golang.org/x/oauth2 in /modules/weaviate (testcontainers#3240) chore(deps): bump mkdocs-include-markdown-plugin from 7.1.5 to 7.1.6 (testcontainers#3239) chore(deps): bump requests from 2.32.0 to 2.32.4 (testcontainers#3204) feat(mcpgateway): add MCP gateway module (testcontainers#3232) chore(deps): bump golang.org/x/oauth2 in /modules/pulsar (testcontainers#3236) ...
What does this PR do?
The generic container allows to set a provider for a container but this is not exposed via the options. This commit adds this capability so that it is possible to set the provider to Podman on MacOS when the auto detection fails
Why is it important?
It is part of what allows using Ryuk on MacOS. One still has to set the VM to run rootless but without this change even with root it does not work because the wrong network is detected
Related issues