Skip to content

Commit

Permalink
Switch script & trigger tests to postgres-backed Sadbonx (#11525)
Browse files Browse the repository at this point in the history
DPP-695 is gift that keeps on giving and seems to also result in
timeouts here. Just marking all of our tests that depend on Sadbonx as
flaky doesn’t seem all that helpful so switch to a postgres-backed
sandbox instead.

changelog_begin
changelog_end
  • Loading branch information
cocreature authored Nov 3, 2021
1 parent 7391a3c commit bb37eef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions daml-script/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ da_scala_library(
"//ledger/sandbox-common",
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"@maven//:com_auth0_java_jwt",
"@maven//:org_scalatest_scalatest_compatible",
Expand Down Expand Up @@ -214,6 +215,7 @@ da_scala_test_suite(
"//libs-scala/contextualized-logging",
"//libs-scala/logging-entries",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"//libs-scala/resources-grpc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import com.daml.bazeltools.BazelRunfiles._
import com.daml.ledger.api.testing.utils.AkkaBeforeAndAfterAll
import com.daml.ledger.api.tls.TlsConfiguration
import com.daml.lf.engine.script.ledgerinteraction.ScriptTimeMode
import com.daml.testing.postgresql.PostgresAroundAll

import scala.concurrent.ExecutionContext

trait SandboxParticipantFixture
extends AbstractScriptTest
with SandboxNextFixture
with PostgresAroundAll
with AkkaBeforeAndAfterAll {
self: Suite =>
private implicit val ec: ExecutionContext = system.dispatcher
Expand Down Expand Up @@ -46,7 +48,10 @@ trait SandboxParticipantFixture
timeProviderType = Some(timeMode match {
case ScriptTimeMode.Static => TimeProviderType.Static
case ScriptTimeMode.WallClock => TimeProviderType.WallClock
})
}),
jdbcUrl = Some(
postgresDatabase.url
),
)

protected def stableDarFile = new File(rlocation("daml-script/test/script-test.dar"))
Expand Down
5 changes: 5 additions & 0 deletions triggers/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,21 @@ da_scala_library(
"//language-support/scala/bindings-akka",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/caching",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/ledger-configuration",
"//ledger/ledger-resources",
"//ledger/participant-integration-api",
"//ledger/sandbox",
"//ledger/sandbox:sandbox-scala-tests-lib",
"//ledger/sandbox-common",
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
"//ledger/test-common",
"//libs-scala/contextualized-logging",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"//triggers/runner:trigger-runner-lib",
"@maven//:org_scalatest_scalatest_compatible",
Expand Down Expand Up @@ -170,6 +174,7 @@ da_scala_library(
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
"//ledger/test-common",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"//libs-scala/scalatest-utils",
"//triggers/runner:trigger-runner-lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ import com.daml.lf.speedy.SValue
import com.daml.lf.speedy.SValue._
import com.daml.platform.sandboxnext.SandboxNextFixture
import com.daml.platform.sandbox.services.TestCommands
import com.daml.testing.postgresql.PostgresAroundAll
import org.scalatest._
import scalaz.syntax.tag._

import scala.collection.compat._
import scala.concurrent.{ExecutionContext, Future}
import scala.util.Try

trait AbstractTriggerTest extends SandboxNextFixture with TestCommands {
trait AbstractTriggerTest extends SandboxNextFixture with PostgresAroundAll with TestCommands {
self: Suite =>

protected def toHighLevelResult(s: SValue) = s match {
Expand Down Expand Up @@ -77,6 +78,10 @@ trait AbstractTriggerTest extends SandboxNextFixture with TestCommands {
Try(BazelRunfiles.requiredResource("triggers/tests/acs.dar"))
.getOrElse(BazelRunfiles.requiredResource("triggers/tests/acs-1.dev.dar"))

override protected def config = super.config.copy(
jdbcUrl = Some(postgresDatabase.url)
)

protected val dar = DarDecoder.assertReadArchiveFromFile(darFile)
protected val compiledPackages =
PureCompiledPackages.assertBuild(dar.all.toMap, speedy.Compiler.Config.Dev)
Expand Down

0 comments on commit bb37eef

Please sign in to comment.