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
When I started to use testcontainers-for-zio, I've realized that I need to set custom WaitStrategy to my Postgres Container. But in the current version of library, there are not so many things I can customize in container definition using ZPostgresContainer.Settings (only image tag and credentials, I guess).
Meanwhile, the implementation of ZKafkaContainer expects KafkaContainer.Def as the incoming type (the R type for ZIO) This configuration, imo, is way more flexible, cause one can provide custom container definition.
May be it would be better to redesign layers for all supported containers to make them accept <contaniner>.Def as R value rather then create container based on Settings object internally?
Anyway it is also possible to provide default layer, with default container.
I'm ready to contribute, if you support my idea.
Thanks in for attention!
The text was updated successfully, but these errors were encountered:
I believe <contaniner>.Def is all we need (whether as generic setting or container based setting). One can simply provide any setting they want using something like this:
// This is provided by defaultvaldefault=ZLayer.succeed(PostgreSQLContainer.Def())
// Use with your own settingscaseclassMyPostgreSQLContainerSettings(dockerImageName: DockerImageName, reuse: Boolean)
valwithReUse:ZLayer[MyPostgreSQLContainerSettings, Nothing, PostgreSQLContainer.Def] =ZLayer.fromFunction { (settings: MyPostgreSQLContainerSettings) =>newPostgreSQLContainer.Def(dockerImageName = settings.dockerImageName) {
overridedefcreateContainer():PostgreSQLContainer= {
valcontainer=super.createContainer()
container.configure(_.withReuse(settings.reuse))
}
}
}
Greetings!
When I started to use testcontainers-for-zio, I've realized that I need to set custom WaitStrategy to my Postgres Container. But in the current version of library, there are not so many things I can customize in container definition using
ZPostgresContainer.Settings
(only image tag and credentials, I guess).Meanwhile, the implementation of ZKafkaContainer expects
KafkaContainer.Def
as the incoming type (theR
type for ZIO) This configuration, imo, is way more flexible, cause one can provide custom container definition.May be it would be better to redesign layers for all supported containers to make them accept
<contaniner>.Def
asR
value rather then create container based on Settings object internally?Anyway it is also possible to provide default layer, with default container.
I'm ready to contribute, if you support my idea.
Thanks in for attention!
The text was updated successfully, but these errors were encountered: