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

fix deprecation warning for PostgreSQLContainer #275

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ class PostgreSQLContainer(
commonJdbcParams: JdbcDatabaseContainer.CommonParams = JdbcDatabaseContainer.CommonParams()
) extends SingleContainer[JavaPostgreSQLContainer[_]] with JdbcDatabaseContainer {

import PostgreSQLContainer._

override val container: JavaPostgreSQLContainer[_] = {
val c: JavaPostgreSQLContainer[_] = dockerImageNameOverride match {
case Some(imageNameOverride) =>
new JavaPostgreSQLContainer(imageNameOverride)
case None =>
new JavaPostgreSQLContainer()
}
val dockerImageName = dockerImageNameOverride.getOrElse(parsedDockerImageName)
val c: JavaPostgreSQLContainer[_] = new JavaPostgreSQLContainer(dockerImageName)

databaseName.foreach(c.withDatabaseName)
pgUsername.foreach(c.withUsername)
Expand Down Expand Up @@ -53,6 +51,9 @@ object PostgreSQLContainer {
val defaultUsername = "test"
val defaultPassword = "test"

private[testcontainers] def parsedDockerImageName: DockerImageName =
DockerImageName.parse(defaultDockerImageName)

def apply(
dockerImageNameOverride: DockerImageName = null,
databaseName: String = null,
Expand All @@ -69,7 +70,7 @@ object PostgreSQLContainer {
)

case class Def(
dockerImageName: DockerImageName = DockerImageName.parse(defaultDockerImageName),
dockerImageName: DockerImageName = parsedDockerImageName,
databaseName: String = defaultDatabaseName,
username: String = defaultUsername,
password: String = defaultPassword,
Expand Down
Loading