daml/triggers/tests/BUILD.bazel
Remy c37d4a257b
[Trigger] Batch messages in case of backpressure (#15902)
Co-authored-by: Carl Pulley <carl.pulley@digitalasset.com>
Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
Co-authored-by: Carl Pulley <106966370+carlpulley-da@users.noreply.github.com>
2022-12-19 09:28:02 +01:00

187 lines
6.8 KiB
Python

# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
"lf_scalacopts_stricter",
)
load("@build_environment//:configuration.bzl", "sdk_version")
DAML_LF_VERSIONS = [
"1.dev",
"", # SDK default
]
[
genrule(
name = "acs" + suffix,
srcs =
glob(["**/*.daml"]) + [
"//triggers/daml:daml-trigger%s.dar" % suffix,
"//daml-script/daml:daml-script%s.dar" % suffix,
] + [
"//templates:copy-trigger/src/CopyTrigger.daml",
],
outs = ["acs%s.dar" % suffix],
cmd = """
set -eou pipefail
TMP_DIR=$$(mktemp -d)
mkdir -p $$TMP_DIR/daml
cp -L $(location :daml/ACS.daml) $$TMP_DIR/daml
cp -L $(location :daml/Retry.daml) $$TMP_DIR/daml
cp -L $(location :daml/ExerciseByKey.daml) $$TMP_DIR/daml
cp -L $(location :daml/CreateAndExercise.daml) $$TMP_DIR/daml
cp -L $(location :daml/MaxInboundMessageTest.daml) $$TMP_DIR/daml
cp -L $(location :daml/Numeric.daml) $$TMP_DIR/daml
cp -L $(location :daml/CommandId.daml) $$TMP_DIR/daml
cp -L $(location :daml/PendingSet.daml) $$TMP_DIR/daml
cp -L $(location :daml/TemplateIdFilter.daml) $$TMP_DIR/daml
cp -L $(location :daml/Time.daml) $$TMP_DIR/daml
cp -L $(location :daml/Heartbeat.daml) $$TMP_DIR/daml
cp -L $(location :daml/ReadAs.daml) $$TMP_DIR/daml
cp -L $(location :daml/ActAs.daml) $$TMP_DIR/daml
cp -L $(location :daml/QueryFilter.daml) $$TMP_DIR/daml
cp -L $(location :daml/Cats.daml) $$TMP_DIR/daml
cp -L $(location :daml/BatchTrigger.daml) $$TMP_DIR/daml
cp -L $(location //templates:copy-trigger/src/CopyTrigger.daml) $$TMP_DIR/daml
cp -L $(location //triggers/daml:daml-trigger{suffix}.dar) $$TMP_DIR/daml-trigger.dar
cp -L $(location //daml-script/daml:daml-script{suffix}.dar) $$TMP_DIR/daml-script.dar
if [ "{lf_version}" = "1.dev" ]
then
cp -L $(location :daml/Interface.daml) $$TMP_DIR/daml
cp -L $(location :daml/InterfaceTriggers.daml) $$TMP_DIR/daml
fi
cat << EOF > $$TMP_DIR/daml.yaml
sdk-version: {sdk}
name: acs
source: daml
version: 0.0.1
dependencies:
- daml-stdlib
- daml-prim
- daml-trigger.dar
- daml-script.dar
EOF
test -z "{lf_version}" || echo "build-options: [--target={lf_version}]" >> $$TMP_DIR/daml.yaml
$(location //compiler/damlc) build --project-root=$$TMP_DIR --ghc-option=-Werror -o $$PWD/$(location acs{suffix}.dar)
rm -rf $$TMP_DIR
""".format(
lf_version = lf_version,
sdk = sdk_version,
suffix = suffix,
),
tools = ["//compiler/damlc"],
visibility = ["//visibility:public"],
)
for lf_version in DAML_LF_VERSIONS
for suffix in [("-" + lf_version) if lf_version else ""]
]
da_scala_library(
name = "test-utils",
srcs = [
"src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractFuncTests.scala",
"src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala",
],
scala_deps = [
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_scalactic_scalactic",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_matchers_core",
"@maven//:org_scalatest_scalatest_shouldmatchers",
"@maven//:org_scalatest_scalatest_wordspec",
"@maven//:org_scalaz_scalaz_core",
],
deps = [
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/interpreter",
"//daml-lf/language",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//language-support/scala/bindings-akka",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger/ledger-resources",
"//ledger/ledger-runner-common",
"//ledger/participant-integration-api",
"//ledger/sandbox-on-x",
"//ledger/sandbox-on-x:sandbox-on-x-test-lib",
"//ledger/test-common",
"//libs-scala/ports",
"//libs-scala/resources",
"//observability/telemetry",
"//triggers/runner:trigger-runner-lib",
"@maven//:org_scalatest_scalatest_compatible",
],
)
[
da_scala_test_suite(
name = "trigger-integration-tests" + suffix,
srcs = [
"src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/%s.scala" % f
for f in [
"FuncTestsStaticTime",
"FuncTestsWallClock",
"Jwt",
"Tls",
"RunnerSpec",
"UnfoldStateSpec",
"ConfigSpec",
] + (["DevOnly"] if lf_version else [])
],
data = [
":acs%s.dar" % suffix,
"//ledger/test-common/test-certificates",
],
resources = ["//triggers/runner:src/main/resources/logback.xml"],
scala_deps = [
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_scalacheck_scalacheck",
"@maven//:org_scalatestplus_scalacheck_1_15",
"@maven//:org_scalaz_scalaz_core",
],
deps = [
":test-utils",
"//bazel_tools/runfiles:scala_runfiles",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interpreter",
"//daml-lf/language",
"//language-support/scala/bindings",
"//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/ledger-runner-common",
"//ledger/participant-integration-api",
"//ledger/sandbox-on-x",
"//ledger/sandbox-on-x:sandbox-on-x-test-lib",
"//ledger/test-common",
"//libs-scala/contextualized-logging",
"//libs-scala/logging-entries",
"//libs-scala/ports",
"//libs-scala/resources",
"//libs-scala/scalatest-utils",
"//observability/telemetry",
"//triggers/runner:trigger-runner-lib",
],
)
for lf_version in DAML_LF_VERSIONS
for suffix in [("-" + lf_version) if lf_version else ""]
]