You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does it make sense to also provide these as options?
The issue I am facing is when trying to start the compose setup incrementally, i.e. start a container, run some tests, start another container that uses the first one as a dependency and run some other tests. This gives me the following errors:
if I specify the container dependencies as part of RunServices (deps), it fails with The container name "..." is already in use by container
If I dont, I get the no such service: ... error
So, I guess if we have the Recreate and RecreateDependencies options exposed, that would help with this, and also allow for more flexible testing setups.
The text was updated successfully, but these errors were encountered:
Hey @sweexordious thanks for opening this issue. I'm currently triaging the repo, focusing on compose stuff.
I think you could achieve it if we exposed the stackUpOptionFunc and stackUpOptions types:
import tccompose "github.com/testcontainers/testcontainers-go/modules/compose"...recreateForceFn:=func() tccompose.StackUpOption {
// At this moment, the types are not exported: // return tccompose.stackUpOptionFunc(func(o *tccompose.stackUpOptions) {returntccompose.StackUpOptionFunc(func(o*tccompose.StackUpOptions) {
o.Recreate=api.RecreateForceo.RecreateDependencies=api.RecreateForce
})
}
Then you would be able to define your own recreation strategy.
I only need to think about the implications of exposing the type, as this module was added long time ago and I'm not that familiar with it as I'd like to.
Proposal
Currently, the implementation uses by default the
"diverged"
recreate strategy for docker-compose setups, and doesn't provide a way to override that:testcontainers-go/modules/compose/compose_api.go
Lines 194 to 195 in bc15b11
Does it make sense to also provide these as options?
The issue I am facing is when trying to start the compose setup incrementally, i.e. start a container, run some tests, start another container that uses the first one as a dependency and run some other tests. This gives me the following errors:
RunServices (deps)
, it fails withThe container name "..." is already in use by container
no such service: ...
errorSo, I guess if we have the
Recreate
andRecreateDependencies
options exposed, that would help with this, and also allow for more flexible testing setups.The text was updated successfully, but these errors were encountered: