mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
fbb3ba55c2
1. Remove `BaseError.Impl`, `LoggingTransactionErrorImpl` and `LoggingPackageServiceError` and instead provide more direct `DamlError` and `DamlErrorWithDefiniteAnswer`. 2. Remove custom implementation of `TransactionError.rpcStatus` and instead provide simpler one in `DamlErr.r.rpcStatus` (which works by first calling `code.asGrpcStatus` and then converting the result to `com.google.rpc.status.Status`). 3. Remove `GrpcStatus.toProto` and instead use `DamlError.rpcStatus`. 4. Use `asGrpcStatus` and `asGrpcError` instead of `asGrpcStatusFromContext` and `asGrpcErrorFromContext` where possible. changelog_begin changelog_end
418 lines
13 KiB
Python
418 lines
13 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",
|
|
)
|
|
load("//ledger/ledger-api-tests:conformance.bzl", "conformance_test", "server_conformance_test")
|
|
load("@oracle//:index.bzl", "oracle_tags")
|
|
load("@os_info//:os_info.bzl", "is_windows")
|
|
|
|
da_scala_library(
|
|
name = "sandbox-on-x",
|
|
srcs = glob(["src/main/scala/**/*.scala"]),
|
|
resources = glob(["src/main/resources/**/*"]),
|
|
scala_deps = [
|
|
"@maven//:com_github_scopt_scopt",
|
|
"@maven//:com_typesafe_akka_akka_actor",
|
|
"@maven//:com_typesafe_akka_akka_stream",
|
|
],
|
|
tags = ["maven_coordinates=com.daml:sandbox-on-x:__VERSION__"],
|
|
visibility = [
|
|
"//visibility:public",
|
|
],
|
|
deps = [
|
|
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
|
|
"//daml-lf/data",
|
|
"//daml-lf/engine",
|
|
"//daml-lf/language",
|
|
"//daml-lf/transaction",
|
|
"//language-support/scala/bindings",
|
|
"//ledger/caching",
|
|
"//ledger/error",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger/ledger-api-health",
|
|
"//ledger/ledger-configuration",
|
|
"//ledger/ledger-offset",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/ledger-runner-common",
|
|
"//ledger/metrics",
|
|
"//ledger/participant-integration-api",
|
|
"//ledger/participant-state",
|
|
"//ledger/participant-state-index",
|
|
"//ledger/participant-state-metrics",
|
|
"//libs-scala/build-info",
|
|
"//libs-scala/concurrent",
|
|
"//libs-scala/contextualized-logging",
|
|
"//libs-scala/logging-entries",
|
|
"//libs-scala/ports",
|
|
"//libs-scala/resources",
|
|
"//libs-scala/resources-akka",
|
|
"//libs-scala/resources-grpc",
|
|
"@maven//:com_google_guava_guava",
|
|
"@maven//:com_google_protobuf_protobuf_java",
|
|
"@maven//:io_dropwizard_metrics_metrics_core",
|
|
"@maven//:org_slf4j_slf4j_api",
|
|
],
|
|
)
|
|
|
|
da_scala_library(
|
|
name = "sandbox-classic-server",
|
|
srcs = glob(["src/classic/scala/**/*.scala"]),
|
|
resources = ["//ledger/sandbox-common:src/main/resources/banner.txt"],
|
|
scala_deps = [
|
|
"@maven//:com_typesafe_akka_akka_actor",
|
|
"@maven//:com_typesafe_akka_akka_stream",
|
|
"@maven//:org_scalaz_scalaz_core",
|
|
],
|
|
tags = ["maven_coordinates=com.daml:sandbox-classic-server:__VERSION__"],
|
|
visibility = [
|
|
"//visibility:public",
|
|
],
|
|
runtime_deps = [
|
|
"@maven//:ch_qos_logback_logback_core",
|
|
"@maven//:com_h2database_h2",
|
|
"@maven//:org_postgresql_postgresql",
|
|
],
|
|
deps = [
|
|
"//daml-lf/archive:daml_lf_1.dev_archive_proto_java",
|
|
"//daml-lf/archive:daml_lf_archive_reader",
|
|
"//daml-lf/data",
|
|
"//daml-lf/language",
|
|
"//language-support/scala/bindings",
|
|
"//ledger/caching",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger/ledger-api-health",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/ledger-runner-common",
|
|
"//ledger/metrics",
|
|
"//ledger/participant-integration-api",
|
|
"//ledger/participant-state",
|
|
"//ledger/sandbox-common:sandbox-common-ce",
|
|
"//ledger/sandbox-on-x",
|
|
"//libs-scala/build-info",
|
|
"//libs-scala/contextualized-logging",
|
|
"//libs-scala/logging-entries",
|
|
"//libs-scala/ports",
|
|
"//libs-scala/resources",
|
|
"//libs-scala/resources-akka",
|
|
"//libs-scala/resources-grpc",
|
|
"@maven//:com_typesafe_config",
|
|
"@maven//:io_dropwizard_metrics_metrics_core",
|
|
"@maven//:org_slf4j_slf4j_api",
|
|
],
|
|
)
|
|
|
|
da_scala_library(
|
|
name = "sandbox-on-x-test-lib",
|
|
srcs = glob(["src/test/lib/**/*.scala"]),
|
|
scala_deps = [
|
|
"@maven//:com_typesafe_akka_akka_actor",
|
|
"@maven//:com_typesafe_akka_akka_stream",
|
|
"@maven//:org_scalactic_scalactic",
|
|
"@maven//:org_scalatest_scalatest_core",
|
|
"@maven//:org_scalatest_scalatest_flatspec",
|
|
"@maven//:org_scalatest_scalatest_matchers_core",
|
|
"@maven//:org_scalatest_scalatest_shouldmatchers",
|
|
"@maven//:org_scalaz_scalaz_core",
|
|
],
|
|
scala_runtime_deps = [
|
|
"@maven//:com_typesafe_akka_akka_slf4j",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
runtime_deps = [
|
|
"@maven//:com_h2database_h2",
|
|
"@maven//:org_postgresql_postgresql",
|
|
],
|
|
deps = [
|
|
":sandbox-classic-server",
|
|
"//daml-lf/data",
|
|
"//language-support/scala/bindings",
|
|
"//ledger-api/rs-grpc-bridge",
|
|
"//ledger-api/testing-utils",
|
|
"//ledger/caching",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-auth-client",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger/ledger-configuration",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/metrics",
|
|
"//ledger/participant-integration-api",
|
|
"//ledger/participant-integration-api:participant-integration-api-tests-lib",
|
|
"//ledger/sandbox-common",
|
|
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
|
|
"//ledger/test-common",
|
|
"//libs-scala/grpc-utils",
|
|
"//libs-scala/ports",
|
|
"//libs-scala/resources",
|
|
"//libs-scala/resources-akka",
|
|
"//libs-scala/resources-grpc",
|
|
"//libs-scala/timer-utils",
|
|
"@maven//:ch_qos_logback_logback_classic",
|
|
"@maven//:io_netty_netty_handler",
|
|
"@maven//:org_scalatest_scalatest_compatible",
|
|
"@maven//:org_slf4j_slf4j_api",
|
|
],
|
|
)
|
|
|
|
da_scala_test_suite(
|
|
name = "sandbox-on-x-unit-tests",
|
|
size = "small",
|
|
srcs = glob(["src/test/suite/**/*.scala"]),
|
|
resources = glob(["src/test/resources/**/*"]),
|
|
scala_deps = [
|
|
"@maven//:org_mockito_mockito_scala",
|
|
],
|
|
deps = [
|
|
":sandbox-on-x",
|
|
"//daml-lf/data",
|
|
"//daml-lf/transaction",
|
|
"//daml-lf/transaction-test-lib",
|
|
"//language-support/scala/bindings",
|
|
"//ledger/error",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger/ledger-api-health",
|
|
"//ledger/ledger-configuration",
|
|
"//ledger/ledger-offset",
|
|
"//ledger/metrics",
|
|
"//ledger/participant-integration-api",
|
|
"//ledger/participant-state",
|
|
"//ledger/participant-state-index",
|
|
"//libs-scala/contextualized-logging",
|
|
"//libs-scala/logging-entries",
|
|
"@maven//:io_dropwizard_metrics_metrics_core",
|
|
"@maven//:org_mockito_mockito_core",
|
|
],
|
|
)
|
|
|
|
da_scala_test_suite(
|
|
name = "sandbox-on-x-it-tests",
|
|
# Sandbox-on-X has high end-to-end submission latency.
|
|
# TODO Downsize to `small` once the latency is optimized
|
|
size = "medium",
|
|
srcs = glob(
|
|
["src/test/it/**/*.scala"],
|
|
),
|
|
data = [
|
|
"//daml-lf/encoder:testing-dars",
|
|
"//ledger/test-common:model-tests-default.dar",
|
|
"//ledger/test-common/test-certificates",
|
|
],
|
|
resources = glob(["src/test/resources/**/*"]),
|
|
scala_deps = [
|
|
"@maven//:com_typesafe_akka_akka_actor",
|
|
"@maven//:com_typesafe_akka_akka_stream",
|
|
"@maven//:org_scalatest_scalatest_core",
|
|
"@maven//:org_scalatest_scalatest_matchers_core",
|
|
"@maven//:org_scalatest_scalatest_shouldmatchers",
|
|
"@maven//:org_scalaz_scalaz_core",
|
|
],
|
|
deps = [
|
|
":sandbox-classic-server",
|
|
":sandbox-on-x",
|
|
":sandbox-on-x-test-lib",
|
|
"//bazel_tools/runfiles:scala_runfiles",
|
|
"//daml-lf/data",
|
|
"//daml-lf/language",
|
|
"//language-support/scala/bindings",
|
|
"//ledger-api/rs-grpc-akka",
|
|
"//ledger-api/rs-grpc-bridge",
|
|
"//ledger-api/testing-utils",
|
|
"//ledger/caching",
|
|
"//ledger/error",
|
|
"//ledger/error:error-test-lib",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-client",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger/ledger-configuration",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/ledger-resources:ledger-resources-test-lib",
|
|
"//ledger/ledger-runner-common",
|
|
"//ledger/metrics",
|
|
"//ledger/participant-integration-api",
|
|
"//ledger/participant-integration-api:participant-integration-api-tests-lib",
|
|
"//ledger/sandbox-common",
|
|
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
|
|
"//ledger/test-common",
|
|
"//libs-scala/contextualized-logging",
|
|
"//libs-scala/grpc-utils",
|
|
"//libs-scala/ports",
|
|
"//libs-scala/postgresql-testing",
|
|
"//libs-scala/resources",
|
|
"//libs-scala/timer-utils",
|
|
"@maven//:ch_qos_logback_logback_classic",
|
|
"@maven//:io_grpc_grpc_services",
|
|
"@maven//:io_netty_netty_handler",
|
|
"@maven//:org_awaitility_awaitility",
|
|
"@maven//:org_scalatest_scalatest_compatible",
|
|
"@maven//:org_slf4j_slf4j_api",
|
|
],
|
|
)
|
|
|
|
da_scala_library(
|
|
name = "sandbox-on-x-app-lib",
|
|
srcs = glob(["src/app/scala/**/*.scala"]),
|
|
resources = glob(["src/app/resources/**/*"]),
|
|
scala_deps = [],
|
|
tags = ["maven_coordinates=com.daml:sandbox-on-x-app:__VERSION__"],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":sandbox-on-x",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/ledger-runner-common",
|
|
"//libs-scala/contextualized-logging",
|
|
"//libs-scala/resources",
|
|
],
|
|
)
|
|
|
|
da_scala_library(
|
|
name = "sandbox-on-x-test-app",
|
|
srcs = glob(["src/test/app/scala/**/*.scala"]),
|
|
resources = glob(["src/test/app/resources/**/*"]),
|
|
scala_deps = [],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":sandbox-on-x",
|
|
"//daml-lf/data",
|
|
"//ledger/caching",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/ledger-runner-common",
|
|
"//ledger/participant-integration-api",
|
|
"//libs-scala/contextualized-logging",
|
|
"//libs-scala/oracle-testing",
|
|
"//libs-scala/ports",
|
|
"//libs-scala/postgresql-testing",
|
|
"//libs-scala/resources",
|
|
],
|
|
)
|
|
|
|
da_scala_binary(
|
|
name = "app",
|
|
main_class = "com.daml.ledger.sandbox.Main",
|
|
tags = [
|
|
"fat_jar",
|
|
"maven_coordinates=com.daml:sandbox-on-x-app-jar:__VERSION__",
|
|
"no_scala_version_suffix",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
runtime_deps = [
|
|
"@maven//:ch_qos_logback_logback_classic",
|
|
"@maven//:ch_qos_logback_logback_core",
|
|
"@maven//:com_h2database_h2",
|
|
],
|
|
deps = [
|
|
":sandbox-on-x-app-lib",
|
|
],
|
|
)
|
|
|
|
da_scala_binary(
|
|
name = "conformance-test-oracle-bin",
|
|
main_class = "com.daml.ledger.sandbox.MainWithEphemeralOracleUser",
|
|
visibility = ["//visibility:public"],
|
|
runtime_deps = [],
|
|
deps = [
|
|
":sandbox-on-x-test-app",
|
|
],
|
|
)
|
|
|
|
da_scala_binary(
|
|
name = "conformance-test-postgres-bin",
|
|
main_class = "com.daml.ledger.sandbox.MainWithEphemeralPostgresql",
|
|
visibility = ["//visibility:public"],
|
|
runtime_deps = [],
|
|
deps = [
|
|
":sandbox-on-x-test-app",
|
|
],
|
|
)
|
|
|
|
SERVERS = {
|
|
"h2database": {
|
|
"binary": ":app",
|
|
},
|
|
"postgresql": {
|
|
"binary": ":conformance-test-postgres-bin",
|
|
},
|
|
"oracle": {
|
|
"binary": ":conformance-test-oracle-bin",
|
|
"tags": oracle_tags,
|
|
},
|
|
}
|
|
|
|
conformance_test(
|
|
name = "conformance-test-no-conflict-checking",
|
|
ports = [6865],
|
|
server = ":app",
|
|
server_args = [
|
|
"--contract-id-seeding=testing-weak",
|
|
"--participant participant-id=example,port=6865",
|
|
"--disable-conflict-checking",
|
|
],
|
|
test_tool_args = [
|
|
"--verbose",
|
|
"--exclude=ClosedWorldIT",
|
|
"--exclude=ContractKeysIT",
|
|
"--exclude=SemanticTests",
|
|
"--exclude=RaceConditionIT",
|
|
"--exclude=ExceptionRaceConditionIT",
|
|
"--exclude=ExceptionsIT:ExRollbackDuplicateKeyCreated",
|
|
"--exclude=ExceptionsIT:ExRollbackDuplicateKeyArchived",
|
|
"--exclude=ConfigManagementServiceIT:CMConcurrentSetConflicting",
|
|
"--exclude=CommandDeduplication",
|
|
"--exclude=CommandServiceIT:CSduplicate",
|
|
"--exclude=PartyManagementServiceIT:PMRejectionDuplicateHint",
|
|
],
|
|
)
|
|
|
|
server_conformance_test(
|
|
name = "conformance-test",
|
|
server_args = [
|
|
"--contract-id-seeding=testing-weak",
|
|
"--participant participant-id=example,port=6865",
|
|
"--enable-user-management=true",
|
|
],
|
|
servers = SERVERS,
|
|
test_tool_args = [
|
|
"--verbose",
|
|
],
|
|
)
|
|
|
|
conformance_test(
|
|
name = "conformance-test-static-time",
|
|
ports = [6865],
|
|
server = ":app",
|
|
server_args = [
|
|
"--contract-id-seeding=testing-weak",
|
|
"--participant participant-id=example,port=6865",
|
|
"--static-time",
|
|
],
|
|
test_tool_args = [
|
|
"--verbose",
|
|
],
|
|
)
|
|
|
|
conformance_test(
|
|
name = "conformance-test-in-memory-fan-out",
|
|
ports = [6865],
|
|
server = ":app",
|
|
server_args = [
|
|
"--contract-id-seeding=testing-weak",
|
|
"--participant participant-id=example,port=6865,ledger-api-transactions-buffer-max-size=10",
|
|
"--buffered-ledger-api-streams",
|
|
],
|
|
test_tool_args = [
|
|
"--verbose",
|
|
],
|
|
)
|