daml/ledger/ledger-api-test-tool-on-canton/BUILD.bazel
Samir Talwar 28873913d9
Bazel: Upgrade Buildifier. (#6625)
Buildifier now comes with a handy attachment to catch single `\`
characters inside strings and replace them with `\\` if the escape
sequence is invalid. Skylark/Python will do this at runtime anyway; this
just makes it clearer what the actual behavior is.

I needed to change `\` characters at the end of lines to `\\` manually
in order to stop Buildifier from simply concatenating the lines
together. Everything else was automatic.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-06 16:07:47 +00:00

81 lines
3.1 KiB
Python

# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//ledger/ledger-api-test-tool:conformance.bzl", "conformance_test")
load("@os_info//:os_info.bzl", "is_windows")
java_binary(
name = "canton",
main_class = "com.digitalasset.canton.CantonApp",
runtime_deps = ["@canton//:lib"],
)
# Disabled on Windows because `coreutils` and `grpcurl` aren't easily available.
genrule(
name = "canton-test-runner-with-dependencies-script",
srcs = [
":canton-test-runner.sh",
],
outs = ["canton-test-runner-with-dependencies.sh"],
cmd = """
cat > $@ <<EOF
#!/usr/bin/env bash
set -euo pipefail
f=bazel_tools/tools/bash/runfiles/runfiles.bash
source "\\$${RUNFILES_DIR:-/dev/null}/\\$$f" 2>/dev/null || \\
source "\\$$(grep -sm1 "^\\$$f " "\\$${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \\
source "\\$$0.runfiles/\\$$f" 2>/dev/null || \\
source "\\$$(grep -sm1 "^\\$$f " "\\$$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \\
source "\\$$(grep -sm1 "^\\$$f " "\\$$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \\
{ echo>&2 "ERROR: cannot find \\$$f"; exit 1; }; f=; set -e
PATH="\\$$(rlocation coreutils_nix/bin):\\$$(rlocation curl_nix/bin):\\$$(rlocation grpcurl_nix/bin):\\$$(rlocation jq_dev_env/bin):\\$$PATH"
export PATH
EOF
cat $< >> $@
""",
) if not is_windows else None
# Required because running `canton-test-runner-with-dependencies-script` directly fails.
sh_binary(
name = "canton-test-runner-with-dependencies",
srcs = [":canton-test-runner-with-dependencies-script"],
# Ideally these would be part of the script definition above, but that doesn't seem to work.
deps = ["@bazel_tools//tools/bash/runfiles"],
) if not is_windows else None
conformance_test(
name = "conformance-test",
# Ideally these would be part of the script definition above, but that doesn't seem to work.
extra_data = [
":bootstrap.canton",
":canton",
":canton.conf",
"@coreutils_nix//:bin/base64",
"@curl_nix//:bin/curl",
"@grpcurl_nix//:bin/grpcurl",
"@jq_dev_env//:jq",
],
ports = [
5011,
5021,
5031,
5041,
],
runner = "@//bazel_tools/client_server/runner:runner",
server = ":canton-test-runner-with-dependencies",
test_tool_args = [
"--verbose",
"--exclude=ContractKeysIT" + # 3 of the more specialized tests currently fail on Canton
",ConfigManagementServiceIT,LedgerConfigurationServiceIT" + # dynamic config management not supported by Canton
",TransactionScaleIT,LotsOfPartiesIT" + # scale tests need timeout-scale-factor 1.5 and 2.0 respectively on Canton
",ClosedWorldIT", # Canton currently fails this test with a different error (missing namespace in "unallocated" party id)
],
# temporarily disabling canton tests, because the api server
# in the canton release still requires old time model fields.
# Enable the tests again, once canton is upgraded.
) if not is_windows else None