daml/ledger/sandbox-on-x/BUILD.bazel
Kamil Bożek c91d9ec3ff
Race condition test suite for the ledger-api-test-tool [DPP-274] (#9138)
* Early draft of the race condition ITs

* Archival vs Successful lookup by key test

* More descriptive failure messages

* Unsuccessful lookup vs non-transient creation test

* Double-archival test

* Fixed a test case name

* Archival vs Creation order test

* Reduced number of test templates

* Improved race test template naming

* Helper object with transaction and template utils

* Simplified transaction util

* Fixed wrong choice name

* Removed redundant println

* Formatted code changes

* Minor change

* CHANGELOG_BEGIN
- Integration Kit - added a test suite for race condition to the ledger-api-test-tool
CHANGELOG_END

* Removed unnecessary sorting of transactions

* Added explanatory comments to test cases

* Mechanism for running ledger-api-test-tool test cases multiple times

* Running each race condition test case 5 times

* Fixed WWArchiveVsNonTransientCreate test case

* Fixed flakiness of RWArchiveVsNonConsumingChoice

* Disabled RaceConditionIT in Canton tests

* Formatted code changes

* Moved RaceConditionIT to conformance tests with unique contract keys mode on for Canton

* Nicer delay mechanism

* Improved WWArchiveVsNonTransientCreate to take contention into account

* Fixed RWTransientCreateVsNonTransientCreate conditions for Canton

* Increased the delay before reading the transaction trees stream to 1 second

* Fixed incorrect conformance tests definition for RaceConditionIT

* Running race condition tests sequentially to avoid timeouts

* Simplified race condition test case definition

* Return sum of durations for repeating test cases in the ledger-api-test-tool

* Reverted previous change with computing sum of durations

* Exclude RaceConditionIT from sandbox-on-x conformance tests

* Print the number of a test run only for cases when the number of repetitions is > 1

* Fixed RWArchiveVsFetch scenario
2021-03-25 23:07:01 +01:00

191 lines
5.6 KiB
Python

# Copyright (c) 2021 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-test-tool:conformance.bzl", "conformance_test")
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_dev_archive_proto_java",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger/caching",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-common",
"//ledger/ledger-api-health",
"//ledger/ledger-resources",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils/app",
"//libs-scala/contextualized-logging",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"//libs-scala/resources-grpc",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
],
)
da_scala_test_suite(
name = "sandbox-on-x-tests",
size = "small",
srcs = glob(["src/test/suite/**/*.scala"]),
data = [
"//ledger/test-common:model-tests.dar",
],
resources = glob(["src/test/resources/**/*"]),
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_mockito_mockito_scala",
"@maven//:org_scalactic_scalactic",
"@maven//:org_scalatest_scalatest",
],
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
],
deps = [
":sandbox-on-x",
"//daml-lf/data",
"//daml-lf/engine",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/caching",
"//ledger/ledger-api-common",
"//ledger/ledger-api-health",
"//ledger/ledger-resources",
"//ledger/ledger-resources:ledger-resources-test-lib",
"//ledger/metrics",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils:kvutils-tests-lib",
"//libs-scala/contextualized-logging",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"//libs-scala/resources-grpc",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:org_mockito_mockito_core",
],
)
da_scala_library(
name = "sandbox-on-x-app",
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-api-common",
"//ledger/ledger-api-health",
"//ledger/ledger-resources",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils/app",
"//libs-scala/contextualized-logging",
"//libs-scala/resources",
],
)
da_scala_binary(
name = "app",
main_class = "com.daml.ledger.sandbox.Main",
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",
],
)
conformance_test(
name = "conformance-test",
ports = [6865],
server = ":app",
server_args = [
"--contract-id-seeding=testing-weak",
"--participant participant-id=example,port=6865",
],
test_tool_args = [
"--verbose",
"--exclude=ClosedWorldIT",
"--exclude=CommandDeduplicationIT",
"--exclude=ContractKeysIT",
"--exclude=SemanticTests",
"--exclude=RaceConditionIT",
],
)
conformance_test(
name = "conformance-test-participant-pruning",
ports = [6865],
server = ":app",
server_args = [
"--contract-id-seeding=testing-weak",
"--participant=participant-id=example,port=6865",
],
test_tool_args = [
"--verbose",
"--include=ParticipantPruningIT",
],
)
conformance_test(
name = "conformance-test-multi-party-submission",
ports = [6865],
server = ":app",
server_args = [
"--contract-id-seeding=testing-weak",
"--participant=participant-id=example,port=6865",
],
test_tool_args = [
"--verbose",
"--include=MultiPartySubmissionIT",
],
)
conformance_test(
name = "benchmark-performance-envelope",
ports = [6865],
server = ":app",
server_args = [
"--contract-id-seeding=testing-weak",
"--participant=participant-id=example,port=6865",
],
test_tool_args = [
"--verbose",
"--perf-tests=PerformanceEnvelope.Throughput.TwentyOPS",
"--perf-tests=PerformanceEnvelope.Latency.1000ms",
"--perf-tests=PerformanceEnvelope.TransactionSize.1000KB",
],
)