mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 16:57:40 +03:00
[Benchtool] Package Benchtool related Daml modules separately from other modules [DPP-1089] (#14231)
Recent changes in //ledger/test-common in Daml modules changed the fully qualified names of templates used by Benchtool, even though they hadn't been changed directly. This made it impossible to filter by template name in a recently created LR IndexDB snapshot. To avoid spurious changes in fully qualified template names (from Benchtool perspective) we are now packaging Benchtool related Daml modules separately from other modules changelog_begin changelog_end
This commit is contained in:
parent
c575d598ff
commit
aa8ad32304
@ -61,7 +61,7 @@ da_scala_library(
|
||||
"//libs-scala/resources-akka",
|
||||
"//libs-scala/resources-grpc",
|
||||
"//libs-scala/timer-utils",
|
||||
"//ledger/test-common:model-tests-%s.scala" % "1.14", # TODO: make the LF version configurable
|
||||
"//ledger/test-common:benchtool-tests-%s.scala" % "1.14", # TODO: make the LF version configurable
|
||||
"//ledger/test-common:dar-files-%s-lib" % "1.14", # TODO: make the LF version configurable
|
||||
"@maven//:io_dropwizard_metrics_metrics_core",
|
||||
"@maven//:io_grpc_grpc_api",
|
||||
@ -75,11 +75,22 @@ da_scala_library(
|
||||
da_scala_library(
|
||||
name = "ledger-api-bench-tool-test-lib",
|
||||
srcs = glob(["src/test/lib/**/*.scala"]),
|
||||
scala_deps = [],
|
||||
scala_deps = [
|
||||
"@maven//:org_scalatest_scalatest_core",
|
||||
"@maven//:org_scalactic_scalactic",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":ledger-api-bench-tool-lib",
|
||||
"//bazel_tools/runfiles:scala_runfiles",
|
||||
"//ledger-api/testing-utils",
|
||||
"//libs-scala/ports",
|
||||
"//ledger/test-common:dar-files-%s-lib" % "1.14",
|
||||
"//language-support/scala/bindings",
|
||||
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
|
||||
"//ledger/sandbox-on-x",
|
||||
"//ledger/sandbox-on-x:sandbox-on-x-test-lib",
|
||||
"//ledger/test-common:dar-files-default-lib",
|
||||
"@maven//:org_slf4j_slf4j_api",
|
||||
],
|
||||
)
|
||||
@ -92,7 +103,7 @@ da_scala_test_suite(
|
||||
),
|
||||
data = [
|
||||
"//daml-lf/encoder:testing-dars",
|
||||
"//ledger/test-common:model-tests-default.dar",
|
||||
"//ledger/test-common:benchtool-tests-default.dar",
|
||||
"//ledger/test-common/test-certificates",
|
||||
],
|
||||
scala_deps = [
|
||||
@ -116,7 +127,7 @@ da_scala_test_suite(
|
||||
"//ledger/test-common",
|
||||
"//libs-scala/postgresql-testing",
|
||||
"//libs-scala/timer-utils",
|
||||
"//ledger/test-common:model-tests-%s.scala" % "1.14",
|
||||
"//ledger/test-common:benchtool-tests-%s.scala" % "1.14",
|
||||
"//ledger/test-common:dar-files-%s-lib" % "1.14",
|
||||
"//daml-script/runner:script-runner-lib",
|
||||
"//language-support/scala/bindings",
|
||||
|
@ -5,7 +5,7 @@ package com.daml.ledger.api.benchtool
|
||||
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig.StreamConfig
|
||||
import com.daml.ledger.api.v1.value.Identifier
|
||||
import com.daml.ledger.test.model.Foo.{Foo1, Foo2, Foo3}
|
||||
import com.daml.ledger.test.benchtool.Foo.{Foo1, Foo2, Foo3}
|
||||
import scalaz.syntax.tag._
|
||||
|
||||
object ConfigEnricher {
|
||||
|
@ -11,7 +11,7 @@ import scala.util.{Failure, Success, Try}
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
object TestDars {
|
||||
private val TestDarInfix = "model-tests"
|
||||
private val TestDarInfix = "benchtool"
|
||||
private lazy val resources: List[String] = TestDar.paths.filter(_.contains(TestDarInfix))
|
||||
|
||||
def readAll(): Try[List[DarFile]] = {
|
||||
|
@ -7,7 +7,7 @@ import com.daml.ledger.api.benchtool.config.WorkflowConfig.FibonacciSubmissionCo
|
||||
import com.daml.ledger.api.v1.commands.{Command, CreateAndExerciseCommand}
|
||||
import com.daml.ledger.api.v1.value.{Identifier, Record, RecordField, Value}
|
||||
import com.daml.ledger.client.binding.Primitive
|
||||
import com.daml.ledger.test.model.Bench.InefficientFibonacci.toNamedArguments
|
||||
import com.daml.ledger.test.benchtool.Bench.InefficientFibonacci.toNamedArguments
|
||||
|
||||
import scala.util.{Success, Try}
|
||||
|
||||
@ -28,10 +28,13 @@ final class FibonacciCommandGenerator(
|
||||
Command.Command.CreateAndExercise(
|
||||
CreateAndExerciseCommand(
|
||||
templateId = Some(
|
||||
com.daml.ledger.test.model.Bench.InefficientFibonacci.id.asInstanceOf[Identifier]
|
||||
com.daml.ledger.test.benchtool.Bench.InefficientFibonacci.id
|
||||
.asInstanceOf[Identifier]
|
||||
),
|
||||
createArguments = Some(
|
||||
toNamedArguments(com.daml.ledger.test.model.Bench.InefficientFibonacci(signatory))
|
||||
toNamedArguments(
|
||||
com.daml.ledger.test.benchtool.Bench.InefficientFibonacci(signatory)
|
||||
)
|
||||
),
|
||||
choice = "InefficientFibonacci_Compute",
|
||||
choiceArgument = Some(
|
||||
|
@ -8,7 +8,7 @@ import com.daml.ledger.api.v1.commands.Command
|
||||
import com.daml.ledger.api.v1.commands.ExerciseByKeyCommand
|
||||
import com.daml.ledger.api.v1.value.{Identifier, Record, RecordField, Value}
|
||||
import com.daml.ledger.client.binding.Primitive
|
||||
import com.daml.ledger.test.model.Foo._
|
||||
import com.daml.ledger.test.benchtool.Foo._
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
|
@ -6,7 +6,7 @@ package com.daml.ledger.api.benchtool.submission
|
||||
import com.daml.ledger.api.v1.commands.Command
|
||||
import com.daml.ledger.api.v1.value.Value
|
||||
import com.daml.ledger.client.binding.Primitive
|
||||
import com.daml.ledger.test.model.Foo.Divulger
|
||||
import com.daml.ledger.test.benchtool.Foo.Divulger
|
||||
|
||||
object FooDivulgerCommandGenerator {
|
||||
|
||||
|
@ -18,19 +18,19 @@ object FooTemplateDescriptor {
|
||||
|
||||
val Foo1: FooTemplateDescriptor = FooTemplateDescriptor(
|
||||
name = "Foo1",
|
||||
templateId = com.daml.ledger.test.model.Foo.Foo1.id.asInstanceOf[Identifier],
|
||||
templateId = com.daml.ledger.test.benchtool.Foo.Foo1.id.asInstanceOf[Identifier],
|
||||
consumingChoiceName = "Foo1_ConsumingChoice",
|
||||
nonconsumingChoiceName = "Foo1_NonconsumingChoice",
|
||||
)
|
||||
val Foo2: FooTemplateDescriptor = FooTemplateDescriptor(
|
||||
name = "Foo2",
|
||||
templateId = com.daml.ledger.test.model.Foo.Foo2.id.asInstanceOf[Identifier],
|
||||
templateId = com.daml.ledger.test.benchtool.Foo.Foo2.id.asInstanceOf[Identifier],
|
||||
consumingChoiceName = "Foo2_ConsumingChoice",
|
||||
nonconsumingChoiceName = "Foo2_NonconsumingChoice",
|
||||
)
|
||||
val Foo3: FooTemplateDescriptor = FooTemplateDescriptor(
|
||||
name = "Foo3",
|
||||
templateId = com.daml.ledger.test.model.Foo.Foo3.id.asInstanceOf[Identifier],
|
||||
templateId = com.daml.ledger.test.benchtool.Foo.Foo3.id.asInstanceOf[Identifier],
|
||||
consumingChoiceName = "Foo3_ConsumingChoice",
|
||||
nonconsumingChoiceName = "Foo3_NonconsumingChoice",
|
||||
)
|
||||
@ -42,7 +42,7 @@ object FooTemplateDescriptor {
|
||||
all.getOrElse(templateName, sys.error(s"Invalid template: $templateName"))
|
||||
|
||||
val Divulger_templateId: Identifier =
|
||||
com.daml.ledger.test.model.Foo.Divulger.id.asInstanceOf[Identifier]
|
||||
com.daml.ledger.test.benchtool.Foo.Divulger.id.asInstanceOf[Identifier]
|
||||
val Divulger_DivulgeContractImmediate = "DivulgeContractImmediate"
|
||||
val Divulger_DivulgeConsumingExercise = "DivulgeConsumingExercise"
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package com.daml.ledger.api.benchtool
|
||||
|
||||
import java.io.File
|
||||
|
||||
import com.daml.bazeltools.BazelRunfiles.rlocation
|
||||
import com.daml.ledger.test.BenchtoolTestDar
|
||||
import com.daml.platform.sandbox.fixture.SandboxFixture
|
||||
import org.scalatest.Suite
|
||||
|
||||
trait BenchtoolSandboxFixture extends SandboxFixture {
|
||||
self: Suite =>
|
||||
|
||||
override protected def packageFiles: List[File] = List(
|
||||
new File(rlocation(BenchtoolTestDar.path))
|
||||
)
|
||||
|
||||
}
|
@ -4,19 +4,19 @@
|
||||
package com.daml.ledger.api.benchtool.submission
|
||||
|
||||
import com.codahale.metrics.MetricRegistry
|
||||
import com.daml.ledger.api.benchtool.BenchtoolSandboxFixture
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig
|
||||
import com.daml.ledger.api.benchtool.metrics.MetricsManager.NoOpMetricsManager
|
||||
import com.daml.ledger.api.benchtool.services.LedgerApiServices
|
||||
import com.daml.ledger.api.testing.utils.SuiteResourceManagementAroundAll
|
||||
import com.daml.ledger.api.v1.ledger_offset.LedgerOffset
|
||||
import com.daml.platform.sandbox.fixture.SandboxFixture
|
||||
import org.scalatest.AppendedClues
|
||||
import org.scalatest.flatspec.AsyncFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
|
||||
class FibonacciCommandSubmitterITSpec
|
||||
extends AsyncFlatSpec
|
||||
with SandboxFixture
|
||||
with BenchtoolSandboxFixture
|
||||
with SuiteResourceManagementAroundAll
|
||||
with Matchers
|
||||
with AppendedClues {
|
||||
|
@ -4,6 +4,7 @@
|
||||
package com.daml.ledger.api.benchtool.submission
|
||||
|
||||
import com.codahale.metrics.MetricRegistry
|
||||
import com.daml.ledger.api.benchtool.BenchtoolSandboxFixture
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig.FooSubmissionConfig.{
|
||||
ConsumingExercises,
|
||||
@ -14,7 +15,6 @@ import com.daml.ledger.api.benchtool.services.LedgerApiServices
|
||||
import com.daml.ledger.api.testing.utils.SuiteResourceManagementAroundAll
|
||||
import com.daml.ledger.api.v1.ledger_offset.LedgerOffset
|
||||
import com.daml.ledger.client.binding
|
||||
import com.daml.platform.sandbox.fixture.SandboxFixture
|
||||
import org.scalatest.AppendedClues
|
||||
import org.scalatest.flatspec.AsyncFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
@ -23,7 +23,7 @@ import scala.concurrent.Future
|
||||
|
||||
class FooCommandSubmitterITSpec
|
||||
extends AsyncFlatSpec
|
||||
with SandboxFixture
|
||||
with BenchtoolSandboxFixture
|
||||
with SuiteResourceManagementAroundAll
|
||||
with Matchers
|
||||
with AppendedClues {
|
||||
|
@ -4,6 +4,7 @@
|
||||
package com.daml.ledger.api.benchtool.submission
|
||||
|
||||
import com.codahale.metrics.MetricRegistry
|
||||
import com.daml.ledger.api.benchtool.BenchtoolSandboxFixture
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig.FooSubmissionConfig.ConsumingExercises
|
||||
import com.daml.ledger.api.benchtool.metrics.MetricsManager.NoOpMetricsManager
|
||||
@ -11,7 +12,6 @@ import com.daml.ledger.api.benchtool.services.LedgerApiServices
|
||||
import com.daml.ledger.api.testing.utils.SuiteResourceManagementAroundAll
|
||||
import com.daml.ledger.api.v1.ledger_offset.LedgerOffset
|
||||
import com.daml.ledger.client.binding
|
||||
import com.daml.platform.sandbox.fixture.SandboxFixture
|
||||
import org.scalatest.{AppendedClues, OptionValues}
|
||||
import org.scalatest.flatspec.AsyncFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
@ -20,7 +20,7 @@ import scala.concurrent.Future
|
||||
|
||||
class NonStakeholderInformeesITSpec
|
||||
extends AsyncFlatSpec
|
||||
with SandboxFixture
|
||||
with BenchtoolSandboxFixture
|
||||
with SuiteResourceManagementAroundAll
|
||||
with Matchers
|
||||
with AppendedClues
|
||||
|
@ -4,18 +4,18 @@
|
||||
package com.daml.ledger.api.benchtool.submission
|
||||
|
||||
import com.codahale.metrics.MetricRegistry
|
||||
import com.daml.ledger.api.benchtool.BenchtoolSandboxFixture
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig
|
||||
import com.daml.ledger.api.benchtool.metrics.MetricsManager.NoOpMetricsManager
|
||||
import com.daml.ledger.api.benchtool.services.LedgerApiServices
|
||||
import com.daml.ledger.api.testing.utils.SuiteResourceManagementAroundAll
|
||||
import com.daml.platform.sandbox.fixture.SandboxFixture
|
||||
import org.scalatest.AppendedClues
|
||||
import org.scalatest.flatspec.AsyncFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
|
||||
class PartyAllocationITSpec
|
||||
extends AsyncFlatSpec
|
||||
with SandboxFixture
|
||||
with BenchtoolSandboxFixture
|
||||
with SuiteResourceManagementAroundAll
|
||||
with Matchers
|
||||
with AppendedClues {
|
||||
|
@ -6,6 +6,7 @@ package com.daml.ledger.api.benchtool.submission
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
import com.codahale.metrics.MetricRegistry
|
||||
import com.daml.ledger.api.benchtool.BenchtoolSandboxFixture
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig
|
||||
import com.daml.ledger.api.benchtool.config.WorkflowConfig.FooSubmissionConfig.ApplicationId
|
||||
import com.daml.ledger.api.benchtool.metrics.MetricsManager.NoOpMetricsManager
|
||||
@ -13,7 +14,6 @@ import com.daml.ledger.api.benchtool.services.LedgerApiServices
|
||||
import com.daml.ledger.api.testing.utils.SuiteResourceManagementAroundAll
|
||||
import com.daml.ledger.api.v1.ledger_offset.LedgerOffset
|
||||
import com.daml.ledger.client.binding
|
||||
import com.daml.platform.sandbox.fixture.SandboxFixture
|
||||
import com.daml.timer.Delayed
|
||||
import org.scalatest.flatspec.AsyncFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
@ -24,7 +24,7 @@ import scala.concurrent.duration.Duration
|
||||
|
||||
class WeightedApplicationIdsAndSubmittersITSpec
|
||||
extends AsyncFlatSpec
|
||||
with SandboxFixture
|
||||
with BenchtoolSandboxFixture
|
||||
with SuiteResourceManagementAroundAll
|
||||
with Matchers
|
||||
with AppendedClues
|
||||
|
@ -143,7 +143,7 @@ conformance_test(
|
||||
|
||||
# This deliberately uses the deploy.jar since that’s what we ship
|
||||
# and we want to test that the extract option works there.
|
||||
# Given subleties in classpaths, it could potentially work
|
||||
# Given subtleties in classpaths, it could potentially work
|
||||
# in the non-deploy jar.
|
||||
sh_test(
|
||||
name = "test-extract",
|
||||
|
@ -40,8 +40,8 @@ trap "rm -rf $$DIR" EXIT
|
||||
|
||||
cd $DIR
|
||||
$JAVA -jar $TEST_TOOL --extract
|
||||
if [[ $(ls | wc -l) != 4 ]]; then
|
||||
echo "Expected 4 DARs but got:"
|
||||
if [[ $(ls | wc -l) != 5 ]]; then
|
||||
echo "Expected 5 DARs but got:"
|
||||
ls
|
||||
exit 1
|
||||
fi
|
||||
|
@ -38,6 +38,7 @@ alias(
|
||||
),
|
||||
]
|
||||
for (target_prefix, target_suffix) in [
|
||||
("benchtool-tests", ".dar"),
|
||||
("model-tests", ".dar"),
|
||||
("dar-files", ""),
|
||||
("dar-files", "-lib"),
|
||||
@ -87,6 +88,7 @@ alias(
|
||||
|
||||
# Correspond to the directories under src/test/lib/daml
|
||||
test_names = [
|
||||
"benchtool",
|
||||
"model",
|
||||
"semantic",
|
||||
"performance",
|
||||
|
Loading…
Reference in New Issue
Block a user