-
-
Notifications
You must be signed in to change notification settings - Fork 512
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(compose): select services via profiles #2758
Merged
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
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This commit allows users of the compose module to selectively enable services by using Docker Compose profiles. More about profiles: https://docs.docker.com/compose/profiles
ngrash
force-pushed
the
compose-profiles
branch
from
September 2, 2024 13:13
b8b2a9e
to
debea8e
Compare
mdelapenya
approved these changes
Sep 2, 2024
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 for adding this! The changes are easy to review and the test is always welcomed.
mdelapenya
added
chore
Changes that do not impact the existing functionality
feature
New functionality or new behaviors on the existing one
compose
Docker Compose.
and removed
chore
Changes that do not impact the existing functionality
labels
Sep 2, 2024
mdelapenya
added a commit
that referenced
this pull request
Sep 3, 2024
* main: feat(wait): for file (#2731) feat(compose): select services via profiles (#2758) chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (#2761) fix: update template too (#2763) chore(deps): bump actions/checkout from 4.1.1 to 4.1.7 (#2762) chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (#2760) fix: check if the discovered docker socket responds (#2741) Upgrade milvus-io/milvus-sdk-go to avoid checksum mismatch. (#2753) Fix trailing slash on Image Prefix (#2747) chore: use new testcontainers/ryuk:0.9.0 image (#2750) chore(deps): bump minimal Go version from 1.21 to 1.22 (#2743)
mdelapenya
added a commit
to mdelapenya/testcontainers-go
that referenced
this pull request
Sep 9, 2024
* main: docs: refine heading badges in README (testcontainers#2770) feat(wait): for file (testcontainers#2731) feat(compose): select services via profiles (testcontainers#2758) chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2761) fix: update template too (testcontainers#2763) chore(deps): bump actions/checkout from 4.1.1 to 4.1.7 (testcontainers#2762) chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2760) fix: check if the discovered docker socket responds (testcontainers#2741) Upgrade milvus-io/milvus-sdk-go to avoid checksum mismatch. (testcontainers#2753) Fix trailing slash on Image Prefix (testcontainers#2747) chore: use new testcontainers/ryuk:0.9.0 image (testcontainers#2750)
mdelapenya
added a commit
to mdelapenya/testcontainers-go
that referenced
this pull request
Sep 11, 2024
* main: ci: add generate for mocks (testcontainers#2774) fix: docker config error handling when config file does not exist (testcontainers#2772) docs: refine heading badges in README (testcontainers#2770) feat(wait): for file (testcontainers#2731) feat(compose): select services via profiles (testcontainers#2758) chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2761) fix: update template too (testcontainers#2763) chore(deps): bump actions/checkout from 4.1.1 to 4.1.7 (testcontainers#2762) chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2760) fix: check if the discovered docker socket responds (testcontainers#2741) Upgrade milvus-io/milvus-sdk-go to avoid checksum mismatch. (testcontainers#2753) Fix trailing slash on Image Prefix (testcontainers#2747) chore: use new testcontainers/ryuk:0.9.0 image (testcontainers#2750)
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?
This PR adds the option to use Compose profiles to enable/disable services based on the profiles defined in the compose file:
The current behavior is not changed unless
WithProfiles
is used.Why is it important?
We would like to use our existing Compose files with
testcontainers-go/modules/compose
to set up test environments locally and in our pipelines.However, our workflow relies on Compose profiles, which currently makes the use of
testcontainers-go/modules/compose
impossible, as only services without profiles are enabled by default.Our workaround is to set up the test environment via the Compose CLI, but we think this could be well automated if
testcontainers-go
supported Compose profiles.Related issues
--profiles
toDockerComposeContainer
testcontainers-java#5041 where as a workaround,withOptions("--profiles foo")
is suggested. This is not possible withtestcontainers-go
as it relies directly on the Go module and does not wrap the CLI.How to test this PR
To only run the tests for this individual feature, you can run
go test -v -run TestDockerComposeAPIWithProfiles
inmodules/compose
.In addition to the unit tests, reviewers can try their own Compose files with profiles:
Follow-ups
From my perspective, this feature is self-contained.
If this gets merged and released, we will adapt our workflow to use
testcontainers-go/modules/compose
for setting up test environments. This might generate more insights and follow-ups.