daml/extractor/BUILD.bazel

162 lines
4.6 KiB
Python
Raw Normal View History

2019-08-13 19:23:03 +03:00
# Copyright (c) 2019 The DAML Authors. All rights reserved.
2019-04-04 11:33:38 +03:00
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
2019-04-04 11:33:38 +03:00
)
load(
"//rules_daml:daml.bzl",
"daml_compile",
2019-04-04 11:33:38 +03:00
)
compileDependencies = [
# this has to come first other as somehow a different instance of grpc-core.jar
"//3rdparty/jvm/io/grpc:grpc_services",
"//daml-lf/data",
"//daml-lf/interface",
"//daml-lf/transaction",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/rs-grpc-akka",
"//language-support/scala/bindings",
"//ledger/ledger-api-client",
New Ledger API test tool (#2282) * New acceptance test tool prototype * Fix transaction filter helper * Address https://github.com/digital-asset/daml/pull/2282#discussion_r308081386 * Address https://github.com/digital-asset/daml/pull/2282#discussion_r308082432 Moreover, creates specific helpers for test DAML code. * Move helpers from session to context Remove a circular dependency between session and context, and limits the usage of implicits. * Run tests with ledgers out of process * Prepare for drop in * Temporary timeout increase * Move bulk of the logic to the test runner * Have a map of tests for CLI integration * Timeout per-test, runner uses context, renaming * Allow usage of time service, integrate semantic tests * Integrate CLI SSL configuration * Integrate failure expectation CLI option * Integrate with failure output verbosity CLI option * Integrate with test listing and picking CLI options * Integrate with timeout scaling CLI option * Integrate with command TTL CLI option * Review CODEOWNERS * Drop previously unimplemented CLI parameters * Expand test todo list to encompass latest additions * Deduplicate some testing infrastructure, swap in new test tool * Remove unused rule * Address https://github.com/digital-asset/daml/pull/2282#discussion_r311045444 * Address https://github.com/digital-asset/daml/pull/2282#discussion_r311051974 * Address https://github.com/digital-asset/daml/pull/2282#discussion_r311035287 * Address https://github.com/digital-asset/daml/pull/2282#discussion_r311055290 * WIP * Make gRPC thread factory spawn non-deamon threads * Remove debug prints, complete divulgence test (missing assertion messages) * Try to detect assertion failure line number * Add Sandbox binary that starts an ephemeral postgres instance This allows us to use the client_server_test bazel macro to run against the sandbox backed by postgres. Fixes #1543 * Add Sandbox binary that starts an ephemeral postgres instance This allows us to use the client_server_test bazel macro to run against the sandbox backed by postgres. Fixes #1543 * Address https://github.com/digital-asset/daml/pull/2282#discussion_r311400695 * Remove TlsConfiguration duplicate, move original to commons * Make assertion more readable Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com> * Fix build errors introduced in previous commit - exclude time service tests from reference-v2 - add copyright header to TlsConfiguration * Complete divulgence test and address review comments Restores comments from original divulgence tests and strives to be as close to them as possible. - Address https://github.com/digital-asset/daml/pull/2282#discussion_r311429169 - Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431156 - Address https://github.com/digital-asset/daml/pull/2282#discussion_r311431913 * Delete old divulgence tests * Restore methods to fetch contracts by template identifier * Run conformance tests on in-memory sandbox * Run conformance tests on the persistent sandbox * Remove workflow identifier workaround * New contract keys test (#2452) * Set channel type for LedgerSession * Add ContractKeysIT * Run tests against reference-server v2 * Removed the old ContractKeysIT. However, ... ... I cannot remove ContractKeysChecks completely, because we have another test path for DARs created prior to DAML-LF 1.6, which doesn't have the submitter == maintainer restriction for contract keys. * Use codegen instead of custom code * Add missing copyright headers * Drop sandbox conformance test suite (seems to not work on Windows CI) * Make time simpler * Test tool tests to run only semantic tests * Make CI behave more consistently * Add missing files to run tests on Postrgres * Fix flaky divulgence test, introduce readable identifiers * Increase sandbox conformance tests timeout * Address https://github.com/digital-asset/daml/pull/2282#discussion_r312363246 * Reintroduce test resource extraction * Read semantic tests from the classpath rather than Bazel * Use codegen types for ContractKeys integration test allocateParty returns Primitive.Party and create and exercise also accept Primitive.Party. This way we don't have to keep a String and Primitive.Party representation around. * Bump timeout for sandbox conformance tests * Remove dependency on Bazel runfiles
2019-08-09 18:00:37 +03:00
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//ledger-service/utils",
"//ledger-service/lf-value-json",
"//3rdparty/jvm/io/netty:netty_tcnative_boringssl_static",
"//3rdparty/jvm/com/chuusai:shapeless",
"//3rdparty/jvm/org/spire_math:kind_projector",
"//3rdparty/jvm/com/github/scopt:scopt",
"//3rdparty/jvm/com/lihaoyi:pprint",
"//3rdparty/jvm/org/tpolecat:doobie_core",
"//3rdparty/jvm/org/tpolecat:doobie_postgres",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/io/circe:circe_core",
"//3rdparty/jvm/io/circe:circe_generic",
"//3rdparty/jvm/io/circe:circe_parser",
"//3rdparty/jvm/io/spray:spray_json",
"//3rdparty/jvm/io/grpc:grpc_netty",
2019-04-04 11:33:38 +03:00
]
TEST_DARS = [
"RecordsAndVariants",
"PrimitiveTypes",
"TransactionExample",
]
2019-04-04 11:33:38 +03:00
[
daml_compile(
name = darmod,
main_src = "src/test/resources/damls/%s.daml" % darmod,
)
for darmod in TEST_DARS
]
2019-04-04 11:33:38 +03:00
genrule(
name = "VeryLargeArchive_src",
outs = ["VeryLargeArchive/Blobs.daml"] + ["VeryLargeArchive/Blob%s.daml" % n for n in range(
1,
32 + 1,
)],
cmd =
'''
filecount=32
outs=($(OUTS))
main="$${outs[0]}"
echo 'daml 1.2
module VeryLargeArchive.Blobs where
import VeryLargeArchive.Blob1()' > "$$main"
firstfil="$${outs[1]}"
echo 'daml 1.2
module VeryLargeArchive.Blob1 where
' > "$$firstfil"
{ for linen in `seq 1 1024`; do
echo -n "x$$linen = "\\"
for charn in `seq 1 16`; do
echo -n qqqqqqqq
done;
echo \\"
done; } >> $$firstfil
for filen in `seq 2 $$filecount`; do
echo "import VeryLargeArchive.Blob$$filen()" >> "$$main"
sed -e '2s/^\\(module .*\\)1/\\1'$$filen/ "$$firstfil" > "$${outs[$$filen]}"
done
''',
)
daml_compile(
name = "VeryLargeArchive",
srcs = [":VeryLargeArchive_src"],
main_src = ":VeryLargeArchive/Blobs.daml",
)
2019-04-04 11:33:38 +03:00
testDependencies = [
":extractor",
"//daml-lf/data-scalacheck",
"//daml-lf/transaction-scalacheck",
"//ledger/sandbox:sandbox",
"//ledger-api/testing-utils",
"//ledger/sandbox:sandbox-scala-tests-lib",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
"//3rdparty/jvm/org/scalatest:scalatest",
2019-04-04 11:33:38 +03:00
] + compileDependencies
da_scala_library(
name = "extractor",
srcs = glob(["src/main/scala/**/*.scala"]),
resources = glob(["src/main/resources/**/*"]),
runtime_deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/ch/qos/logback:logback_core",
],
deps = compileDependencies,
2019-04-04 11:33:38 +03:00
)
da_scala_binary(
name = "extractor-binary",
main_class = "com.digitalasset.extractor.Main",
tags = [
"maven_coordinates=com.digitalasset:extractor:__VERSION__",
"no_scala_version_suffix",
],
visibility = ["//visibility:public"],
deps = [
":extractor",
],
2019-04-04 11:33:38 +03:00
)
da_scala_library(
name = "extractor-scala-tests-lib",
srcs = glob(["src/test/lib/**/*.scala"]),
deps = testDependencies,
2019-04-04 11:33:38 +03:00
)
da_scala_test_suite(
name = "extractor-scala-tests",
size = "medium",
srcs = glob(["src/test/suite/**/*.scala"]),
2019-04-04 11:33:38 +03:00
data = [
"//daml-lf/encoder:testing-dar-latest",
2019-04-15 17:45:08 +03:00
"//extractor:PrimitiveTypes.dar",
"//extractor:RecordsAndVariants.dar",
"//extractor:TransactionExample.dar",
"//extractor:VeryLargeArchive.dar",
"@postgresql_dev_env//:all",
"@postgresql_dev_env//:createdb",
"@postgresql_dev_env//:initdb",
"@postgresql_dev_env//:pg_ctl",
2019-04-04 11:33:38 +03:00
],
resources = glob(["src/test/resources/**/*"]),
2019-04-04 11:33:38 +03:00
deps = [
":extractor-scala-tests-lib",
"//bazel_tools/runfiles:scala_runfiles",
2019-04-04 11:33:38 +03:00
] + testDependencies,
)