Skip to content
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): allow running specific services in compose #337

Merged
merged 7 commits into from
May 9, 2023

Conversation

balint-backmaker
Copy link
Contributor

@balint-backmaker balint-backmaker commented Apr 19, 2023

Changes

  • the DockerCompose class now has a new optional argument for services
  • this allows you to run specific services only instead of all of them
  • auto-sorting of imports in the compose/__init__.py for convenience (no proper isort right now, just this file)

Issues

Should resolve #315 on a very basic level.

I'll be raising more PRs for QoL:
https://github.com/testcontainers/testcontainers-python/issues?q=is%3Aopen+is%3Aissue+compose

Copy link
Contributor Author

@balint-backmaker balint-backmaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding author annotations for easier understanding of my intent.

compose/testcontainers/compose/__init__.py Show resolved Hide resolved
compose/tests/test_docker_compose.py Outdated Show resolved Hide resolved
@balint-backmaker
Copy link
Contributor Author

@tillahoffmann I've updated the tests to exercise the docker-compose. Unfortunately couldn't do it easily on chrome or firefox because they exit pretty fast and don't want to understand the container mechanics right off the bat.

As a workaround I ended up exercising the hub and thus turning it on/off and proving my point that way.
With Docker Compose V2, this test will become better asserted so I think I'll go there next after this one. Yay for docker-compose ps --format json :)

@tillahoffmann
Copy link
Collaborator

Looks good; just a linting error to fix.

@balint-backmaker
Copy link
Contributor Author

Looks good; just a linting error to fix.

fixed - can you rerun the tests for me and merge at will?

I've started looking at the compose-v2 stuff but I'll move that onto the issue discussion (because v2 isn't a python package any more so rather would stick it to the issue instead of a PR)

compose/testcontainers/compose/__init__.py Outdated Show resolved Hide resolved
@tillahoffmann tillahoffmann merged commit 94a63d6 into testcontainers:main May 9, 2023
@tillahoffmann
Copy link
Collaborator

Thanks for the contribution!

@MCatherine1994
Copy link

Hello there, I wonder if this feature is already included? or we still need to wait for a new version release?

Thanks!!

@tillahoffmann
Copy link
Collaborator

Not yet, but should be soon when #330 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker compose start with selected service
3 participants