From bb37eef1563e740fc4563d922d5af92b32521c7b Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Wed, 3 Nov 2021 09:39:46 +0100 Subject: [PATCH] Switch script & trigger tests to postgres-backed Sadbonx (#11525) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- daml-script/test/BUILD.bazel | 2 ++ .../lf/engine/script/test/SandboxParticipantFixture.scala | 7 ++++++- triggers/tests/BUILD.bazel | 5 +++++ .../daml/lf/engine/trigger/test/AbstractTriggerTest.scala | 7 ++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/daml-script/test/BUILD.bazel b/daml-script/test/BUILD.bazel index e05013ccd765..875dc382866b 100644 --- a/daml-script/test/BUILD.bazel +++ b/daml-script/test/BUILD.bazel @@ -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", @@ -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", diff --git a/daml-script/test/src/test-utils/com/daml/lf/engine/script/test/SandboxParticipantFixture.scala b/daml-script/test/src/test-utils/com/daml/lf/engine/script/test/SandboxParticipantFixture.scala index 174f3f36ca42..5c55fbdae9dc 100644 --- a/daml-script/test/src/test-utils/com/daml/lf/engine/script/test/SandboxParticipantFixture.scala +++ b/daml-script/test/src/test-utils/com/daml/lf/engine/script/test/SandboxParticipantFixture.scala @@ -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 @@ -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")) diff --git a/triggers/tests/BUILD.bazel b/triggers/tests/BUILD.bazel index f7ee716c047d..7ce9102b887a 100644 --- a/triggers/tests/BUILD.bazel +++ b/triggers/tests/BUILD.bazel @@ -105,10 +105,13 @@ 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", @@ -116,6 +119,7 @@ da_scala_library( "//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", @@ -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", diff --git a/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala b/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala index 773434df9444..18f0cb02b78b 100644 --- a/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala +++ b/triggers/tests/src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala @@ -28,6 +28,7 @@ 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._ @@ -35,7 +36,7 @@ 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 { @@ -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)