feat(compose): select services via profiles#2758
Merged
mdelapenya merged 1 commit intotestcontainers:mainfrom Sep 2, 2024
Merged
feat(compose): select services via profiles#2758mdelapenya merged 1 commit intotestcontainers:mainfrom
mdelapenya merged 1 commit intotestcontainers:mainfrom
Conversation
✅ 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
b8b2a9e to
debea8e
Compare
mdelapenya
approved these changes
Sep 2, 2024
Member
mdelapenya
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding this! The changes are easy to review and the test is always welcomed.
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)
This file contains hidden or 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
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
WithProfilesis used.Why is it important?
We would like to use our existing Compose files with
testcontainers-go/modules/composeto 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/composeimpossible, 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-gosupported Compose profiles.Related issues
--profilestoDockerComposeContainertestcontainers-java#5041 where as a workaround,withOptions("--profiles foo")is suggested. This is not possible withtestcontainers-goas 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 TestDockerComposeAPIWithProfilesinmodules/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/composefor setting up test environments. This might generate more insights and follow-ups.