daml/ledger/ledger-api-test-tool/BUILD.bazel
Gary Verhaegen d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00

318 lines
13 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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_library_suite",
"da_scala_test_suite",
"silencer_plugin",
)
load(
"//rules_daml:daml.bzl",
"daml_compile",
)
load(
"//daml-lf/language:daml-lf.bzl",
"lf_version_configuration",
"lf_version_configuration_versions",
)
load(
"//language-support/scala/codegen:codegen.bzl",
"dar_to_scala",
)
load(
":conformance.bzl",
"conformance_test",
)
load(":util.bzl", "suites_sources")
load("@os_info//:os_info.bzl", "is_windows")
# we release ledger-api-test-tool-stable as ledger-api-test-tool
da_scala_binary(
name = "ledger-api-test-tool",
srcs = [],
main_class = "com.daml.ledger.api.testtool.LedgerApiTestTool",
resources = [
"src/main/resources/logback.xml",
],
tags = [
"maven_coordinates=com.daml:ledger-api-test-tool:__VERSION__",
# We release this as a fat jar so this tag ensures that the dependencies in the generated
# POM file are set correctly.
"fat_jar",
"no_scala_version_suffix",
],
visibility = ["//visibility:public"],
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
],
deps = [":ledger-api-test-tool-default"],
)
[
[
alias(
name = "ledger-api-test-tool-%s%s" % (name, target_suffix),
actual = ":ledger-api-test-tool-%s%s" % (lf_target, target_suffix),
visibility = ["//visibility:public"],
),
]
for target_suffix in [
"",
"-lib",
"-tests",
"-test-suites",
]
for (name, lf_target) in lf_version_configuration.items()
]
[
[
da_scala_library(
name = "ledger-api-test-tool-%s-lib" % lf_version,
srcs = glob(["src/main/scala/com/daml/ledger/api/testtool/infrastructure/**/*.scala"]),
plugins = [
silencer_plugin,
],
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:org_scala_lang_modules_scala_java8_compat",
"@maven//:org_scalameta_munit",
],
visibility = ["//:__subpackages__"],
deps = [
"//daml-lf/data",
"//language-support/scala/bindings",
"//ledger/test-common:test-common-%s" % lf_version,
"//ledger/test-common:model-tests-%s.scala" % lf_version,
"//ledger/test-common:dar-files-%s-lib" % lf_version,
"//ledger-api/grpc-definitions:ledger_api_proto_scala",
"//ledger/error",
"//ledger/ledger-api-common",
"//libs-scala/build-info",
"//libs-scala/grpc-utils",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"//libs-scala/resources-grpc",
"//libs-scala/timer-utils",
"@maven//:com_google_api_grpc_proto_google_common_protos",
"@maven//:com_typesafe_config",
"@maven//:io_netty_netty_common",
"@maven//:io_netty_netty_transport",
"@maven//:junit_junit",
"@maven//:org_slf4j_slf4j_api",
],
),
da_scala_library_suite(
name = "ledger-api-test-tool-%s-test-suites" % lf_version,
srcs = suites_sources(lf_version),
plugins = [
silencer_plugin,
],
scala_deps = [
"@maven//:com_chuusai_shapeless",
"@maven//:org_scala_lang_modules_scala_collection_compat",
],
scaladoc = False,
visibility = [
"//:__subpackages__",
],
deps = [
":ledger-api-test-tool-%s-lib" % lf_version,
"//daml-lf/data",
"//language-support/scala/bindings",
"//ledger/error",
"//ledger/ledger-api-common",
"//ledger/ledger-resources",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"//libs-scala/resources-grpc",
"//ledger/test-common:test-common-%s" % lf_version,
"//ledger/test-common:package_management-tests-%s.scala" % lf_version,
"//ledger/test-common:model-tests-%s.scala" % lf_version,
"//ledger/test-common:performance-tests-%s.scala" % lf_version,
"//ledger/test-common:semantic-tests-%s.scala" % lf_version,
"//ledger/test-common:dar-files-%s-lib" % lf_version,
"//libs-scala/grpc-utils",
"//libs-scala/timer-utils",
"@maven//:io_grpc_grpc_api",
"@maven//:io_grpc_grpc_context",
"@maven//:io_grpc_grpc_netty",
"@maven//:io_netty_netty_handler",
"@maven//:org_slf4j_slf4j_api",
],
),
da_scala_library(
name = "ledger-api-test-tool-%s-tests" % lf_version,
srcs = glob(["src/main/scala/com/daml/ledger/api/testtool/tests/**/*.scala"]),
visibility = ["//:__subpackages__"],
deps = [
"//daml-lf/language",
"//ledger/test-common:dar-files-%s-lib" % lf_version,
"//ledger-api/grpc-definitions:ledger_api_proto_scala",
":ledger-api-test-tool-%s-lib" % lf_version,
":ledger-api-test-tool-%s-test-suites" % lf_version,
],
),
da_scala_binary(
name = "ledger-api-test-tool-%s" % lf_version,
srcs = glob(["src/main/scala/com/daml/ledger/api/testtool/*.scala"]),
main_class = "com.daml.ledger.api.testtool.LedgerApiTestTool",
plugins = [
silencer_plugin,
],
resources = [
"src/main/resources/logback.xml",
],
scala_deps = [
"@maven//:org_scala_lang_modules_scala_collection_compat",
"@maven//:com_github_scopt_scopt",
],
tags = [
"maven_coordinates=com.daml:ledger-api-test-tool-{}:__VERSION__".format(lf_version),
# We release this as a fat jar so this tag ensures that the dependencies in the generated
# POM file are set correctly.
"fat_jar",
"no_scala_version_suffix",
],
visibility = ["//visibility:public"],
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
],
deps = [
":ledger-api-test-tool-%s-lib" % lf_version,
":ledger-api-test-tool-%s-tests" % lf_version,
"//ledger/ledger-api-common",
"//libs-scala/build-info",
"//libs-scala/resources",
"//libs-scala/resources-akka",
"//libs-scala/resources-grpc",
"@maven//:io_grpc_grpc_api",
"@maven//:io_grpc_grpc_core",
"@maven//:io_grpc_grpc_netty",
"@maven//:io_netty_netty_handler",
"@maven//:org_slf4j_slf4j_api",
],
),
]
for lf_version in lf_version_configuration_versions
]
da_scala_test_suite(
name = "ledger-api-test-tool-unit-tests",
srcs = glob(["src/test/suite/scala/**/*.scala"]),
scala_deps = [
"@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 = [
":ledger-api-test-tool-default-lib",
":ledger-api-test-tool-default-tests",
"//daml-lf/data",
"@maven//:org_scalatest_scalatest_compatible",
],
)
conformance_test(
name = "conformance-test",
extra_data = [
"//ledger/test-common/test-certificates:client.crt",
"//ledger/test-common/test-certificates:client.pem",
"//ledger/test-common/test-certificates:server.crt",
"//ledger/test-common/test-certificates:server.pem",
"//ledger/test-common/test-certificates:server.pem.enc",
"//ledger/test-common/test-certificates:ca.crt",
],
lf_versions = lf_version_configuration_versions,
ports = [6865],
server = "//ledger/ledger-on-memory:app",
server_args = [
"--contract-id-seeding=testing-weak",
"--participant=participant-id=example,port=6865",
"--crt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:server.crt))",
"--cacrt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:ca.crt))",
"--pem $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:server.pem.enc))",
"--tls-secrets-url https://raw.githubusercontent.com/digital-asset/daml/main/ledger/test-common/files/server-pem-decryption-parameters.json",
"--min-tls-version 1.3",
],
test_tool_args = [
"--verbose",
"--crt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:client.crt))",
"--cacrt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:ca.crt))",
"--pem $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:client.pem))",
"--additional=IdentityIT",
"--additional=IdentityIT:IdNotEmpty",
# Explicitly include retired tests here to make sure existing CI pipelines are not broken.
# Retired tests will be eventually removed.
"--additional=LotsOfPartiesIT",
"--additional=TransactionScaleIT",
"--additional=TLSOnePointThreeIT",
"--exclude=CommandDeduplicationIT",
# Makes sure that deprecated CLI options can still be used to make sure existing CI pipelines are not broken.
# This test should fail if any deprecated CLI option has any effect whatsoever -- they are preserved
# exclusively for backwards-compatibility.
# Deprecated CLI options will be eventually removed.
"--load-scale-factor=THIS_OPTION_IS_DEPRECATED_AND_HAS_NO_EFFECT",
"--target-port=THIS_OPTION_IS_DEPRECATED_AND_HAS_NO_EFFECT",
"--all-tests",
],
)
conformance_test(
name = "conformance-test-tls1.2-or-newer",
extra_data = [
"//ledger/test-common/test-certificates:client.crt",
"//ledger/test-common/test-certificates:client.pem",
"//ledger/test-common/test-certificates:server.crt",
"//ledger/test-common/test-certificates:server.pem",
"//ledger/test-common/test-certificates:server.pem.enc",
"//ledger/test-common/test-certificates:ca.crt",
],
lf_versions = lf_version_configuration_versions,
ports = [6865],
server = "//ledger/ledger-on-memory:app",
server_args = [
"--contract-id-seeding=testing-weak",
"--participant=participant-id=example,port=6865",
"--crt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:server.crt))",
"--cacrt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:ca.crt))",
"--pem $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:server.pem.enc))",
"--tls-secrets-url https://raw.githubusercontent.com/digital-asset/daml/main/ledger/test-common/files/server-pem-decryption-parameters.json",
],
test_tool_args = [
"--verbose",
"--crt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:client.crt))",
"--cacrt $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:ca.crt))",
"--pem $$(rlocation $$TEST_WORKSPACE/$(rootpath //ledger/test-common/test-certificates:client.pem))",
"--include=TLSAtLeastOnePointTwoIT",
],
)
# This deliberately uses the deploy.jar since thats what we ship
# and we want to test that the extract option works there.
# Given subleties in classpaths, it could potentially work
# in the non-deploy jar.
sh_test(
name = "test-extract",
srcs = ["test-extract.sh"],
args = [
"$(location @local_jdk//:bin/java.exe)" if is_windows else "$(location @local_jdk//:bin/java)",
"$(location :ledger-api-test-tool_deploy.jar)",
],
data = [
":ledger-api-test-tool_deploy.jar",
"@local_jdk//:bin/java.exe" if is_windows else "@local_jdk//:bin/java",
],
deps = [
"@bazel_tools//tools/bash/runfiles",
],
)