• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

input-output-hk / atala-prism-building-blocks / 6324188894

27 Sep 2023 09:41AM UTC coverage: 29.012% (-0.1%) from 29.134%
6324188894

Pull #693

bvoiturier
Merge branch 'main' into feat/new-anoncred-endpoints
Pull Request #693: [WIP] feat: new IssuedCredentialFormat for anoncred

726 of 726 new or added lines in 50 files covered. (100.0%)

3592 of 12381 relevant lines covered (29.01%)

0.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.75
/shared/src/main/scala/io/iohk/atala/shared/test/containers/PostgresLayer.scala
1
package io.iohk.atala.shared.test.containers
2

3
import com.dimafeng.testcontainers.PostgreSQLContainer
4
import doobie.util.transactor.Transactor
5
import io.iohk.atala.shared.db.ContextAwareTask
6
import io.iohk.atala.shared.db.DbConfig
7
import io.iohk.atala.shared.db.TransactorLayer
8
import io.iohk.atala.shared.test.containers.PostgresTestContainer.postgresContainer
9
import zio.*
10

11
object PostgresLayer {
12

1✔
13
  def postgresLayer(
1✔
14
      imageName: Option[String] = Some("postgres:13"),
1✔
15
      verbose: Boolean = false
16
  ): TaskLayer[PostgreSQLContainer] =
1✔
17
    ZLayer.scoped {
×
18
      ZIO
×
19
        .acquireRelease(ZIO.attemptBlockingIO {
×
20
          postgresContainer(imageName, verbose)
×
21
        })(container => ZIO.attemptBlockingIO(container.stop()).orDie)
22
        // Start the container outside the aquireRelease as this might fail
23
        // to ensure contianer.stop() is added to the finalizer
1✔
24
        .tap(container => ZIO.attemptBlocking(container.start()))
25
    }
26

1✔
27
  private def dbConfig(container: PostgreSQLContainer): DbConfig = {
1✔
28
    DbConfig(
1✔
29
      username = container.username,
1✔
30
      password = container.password,
1✔
31
      jdbcUrl = container.jdbcUrl
32
    )
33
  }
34

35
  lazy val dbConfigLayer: ZLayer[PostgreSQLContainer, Nothing, DbConfig] =
1✔
36
    ZLayer.fromZIO { ZIO.serviceWith[PostgreSQLContainer](dbConfig) }
37

×
38
  def transactor: ZLayer[DbConfig, Throwable, Transactor[ContextAwareTask]] = TransactorLayer.contextAwareTask
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc