-
Notifications
You must be signed in to change notification settings - Fork 320
Add CustomContainer exposing settings through the class #238
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
Conversation
Great, thank you! Slight misunderstanding: I was thinking that we could add this functionality to existing containers rather than create a new one. What do you think? |
I don't there is any current class (except for the deprecated |
The image name can be specified for testcontainers-python/testcontainers/core/container.py Lines 12 to 13 in 7346345
|
True, you have a point there. Just to clarify, do you suggest extending the I think the DockerContainer approach would be convenient and won't require a new class. I can test the approach tomorrow and see if it would impact existing implementations. |
I was thinking all the containers as they all inherit from |
Ah, good thought. Sorry for not picking up on this but I'll update the PR. |
6e3291a
to
8622477
Compare
@tillahoffmann updated the PR to instead set these in the core container's If so, I'll make sure these changes are covered by tests as well. |
Ping @tillahoffmann this is another great PR |
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.
Looks good, I left a few small comments. If you could add tests, that'd be great! 🙏
Will take a look and add tests and do the updates when I am back at a computer (might take a few weeks) |
Co-authored-by: Till Hoffmann <tillahoffmann@gmail.com>
ac8b58f
to
2c4eb3b
Compare
Add test that tests that attributes can be set through the __init__ function and later read through class attr. This test does not test that the attributes has an actual effect, in the future it might be of interest to test the integration to the docker container and ensure that class attributes are propagated properly.
@tillahoffmann please take a look at the tests. I added test that tests that attributes can be set through the init function and later read through class attr. The test does not test that the attributes has an actual effect, in the future it might be of interest to test the integration to the docker container and ensure that class attributes are propagated properly. However, I for the changes in this PR I think the current is good enough. |
This PR seems to have stalled, but is a really good idea. What do we need to do to get it over the finish line? |
self.env = {} | ||
self.ports = {} | ||
self.volumes = {} | ||
def __init__( |
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.
Can we do the same with network
and network_aliases
? I suspect we need to rebase this PR in order to pickup these attributes.
It's been a while, but it's still a feature I would like to have (now I use a |
Let me know if I can help - I can attempt a rebase and PR your branch or honestly your idea of just resubmitting might be just as easy. |
Hi @vikahl and @rhoban13, we had this talk or similar notion/idea on #559, we ended up with https://github.com/testcontainers/testcontainers-python/blob/main/modules/generic/testcontainers/generic/server.py which emphasis the notion to do custom stuff as a module (outside of core). |
I might suggest resubmitting this PR separately as the original intent sounds just like the |
I resubmitted as the above PR on an updated branch in hopes of getting it landed. I'm not sure who I need to reach out to to kick off the validations and get a review. |
prefer #809 but will leave both open until i have time to review + merge |
…args (testcontainers#809) Re submitting what is the end result of the iterations in testcontainers#238 submitted originally by @vikhal. Simply enabling the initializer of `DockerContainer` to accept its private members as kwargs. --------- Co-authored-by: David Ankin <daveankin@gmail.com>
Add a
CustomContainer
exposing the settings through the class.Close #236