-
-
Notifications
You must be signed in to change notification settings - Fork 511
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: expose JSON representation of a container with Inspect #2534
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
They can be used simply calling c.Inspect, without any other calculation
mdelapenya
added
the
feature
New functionality or new behaviors on the existing one
label
May 7, 2024
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
mdelapenya
added a commit
to khartld/testcontainers-go
that referenced
this pull request
May 7, 2024
* main: (44 commits) feat: expose JSON representation of a container with Inspect (testcontainers#2534) chore(deps): bump test-summary action to v2.3 (testcontainers#2535) chore(deps): bump jinja2 from 3.1.3 to 3.1.4 (testcontainers#2533) Update devcontainer image (testcontainers#2531) chore(influxdb): include more characters in wait for log regex (testcontainers#2532) fix(compose): avoid race conditions when caching services (testcontainers#2528) chore(deps): bump golangci/golangci-lint-action from 3.7.0 to 5.1.0 (testcontainers#2525) chore(deps): bump mkdocs-material from 8.2.7 to 9.1.21 (testcontainers#2524) chore(compose): return error in options (testcontainers#2520) chore(deps): bump github.com/compose-spec/compose-go/v2 from v2.0.0-rc8 to v2.1.0 (testcontainers#2519) chore(deps): bump github.com/containerd/containerd from 1.7.12 to 1.7.15 (testcontainers#2517) break: return error from Customize request option (testcontainers#2267) fix: wrong copy paste (testcontainers#2515) docs: add documentation for Exec method (testcontainers#2451) docs: document the SSHd tunnel (testcontainers#2514) fix: enhance host configuration port binding (testcontainers#2512) feat: forward host ports to a container using an SSH tunnel (testcontainers#2471) Update follow_logs.md with adding missing package (testcontainers#2513) fix: don't retry on permanent APIClient errors (testcontainers#2506) feat: support overriding the default recreate options for compose (testcontainers#2511) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
It exposes the existing inspect method to the Container interface. That will allow consumers to get the JSON representation of the container.
This new method will cache the raw JSON, which will be cleaned after stopping/terminating a container. Remember that when a container is stopped, the JSON representation could change.
At the same time, given the Inspect method retrives all the container info, we are deprecating two container methods: Name and Ports, as they are just passing-through ones. Consumers will just call inspect and from there get the container name and the ports. The deprecation paths have been properly set in the method comments, so the IDEs and the linters will complain/warn about them.
Deprecation Path
c.Inspect(ctx).Name
insteadc.Inspect(ctx).NetworkSettings.Ports
insteadAs
Inspect
returns an error, you must handle it before reading Name or the Ports.Why is it important?
It will allow consumers to get the JSON representation of the container.
Related issues