Skip to content

Latest commit

 

History

History
58 lines (49 loc) · 1.6 KB

File metadata and controls

58 lines (49 loc) · 1.6 KB

embedded-postgresql

Maven dependency

pom.xml
<dependency>
    <groupId>com.playtika.testcontainers</groupId>
    <artifactId>embedded-postgresql</artifactId>
    <scope>test</scope>
</dependency>

Consumes (via bootstrap.properties)

  • embedded.postgresql.enabled (true|false, default is 'true')

  • embedded.postgresql.reuseContainer (true|false, default is 'false')

  • embedded.postgresql.dockerImage (default is set to 'postgres:9.6.8')

  • embedded.postgresql.waitTimeoutInSeconds (default is 60 seconds)

  • embedded.postgresql.database

  • embedded.postgresql.user

  • embedded.postgresql.password

  • embedded.postgresql.initScriptPath (default is null)

  • embedded.postgresql.startupLogCheckRegex (default is null)

Produces

  • embedded.postgresql.port

  • embedded.postgresql.host

  • embedded.postgresql.schema

  • embedded.postgresql.user

  • embedded.postgresql.password

Example (Spring Boot)

bootstrap-test.yml

embedded:
  postgresql:
    enabled: true
    docker-image: 'bitnami/postgresql:13.1.0'
    wait-timeout-in-seconds: 40
    command: '/opt/bitnami/scripts/postgresql/run.sh'
    startupLogCheckRegex: '.*database system is ready to accept connections.*'

application-test.yml

spring:
  datasource:
    url: "jdbc:postgresql://${embedded.postgresql.host}:${embedded.postgresql.port}/${embedded.postgresql.schema}"
    username: ${embedded.postgresql.user}
    password: ${embedded.postgresql.password}