2020-01-16 15:02:16 +03:00
|
|
|
# Copyright (c) 2020 The DAML Authors. All rights reserved.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
load(
|
|
|
|
"//bazel_tools:scala.bzl",
|
|
|
|
"da_scala_binary",
|
|
|
|
"da_scala_library",
|
2020-01-24 17:33:11 +03:00
|
|
|
"da_scala_test_suite",
|
2020-01-16 15:02:16 +03:00
|
|
|
)
|
|
|
|
load("//ledger/ledger-api-test-tool:conformance.bzl", "conformance_test")
|
|
|
|
|
|
|
|
supported_databases = [
|
|
|
|
{
|
2020-01-22 18:54:51 +03:00
|
|
|
"name": "h2-memory",
|
2020-01-24 17:33:11 +03:00
|
|
|
"runtime_deps": [
|
|
|
|
"@maven//:com_h2database_h2",
|
|
|
|
],
|
2020-01-16 15:02:16 +03:00
|
|
|
"conformance_test_tags": [
|
|
|
|
"manual",
|
|
|
|
],
|
|
|
|
"conformance_test_server_args": [
|
2020-01-22 18:54:51 +03:00
|
|
|
"--jdbc-url=jdbc:h2:mem:daml-on-sql-conformance-test",
|
|
|
|
],
|
|
|
|
"conformance_test_tool_args": [
|
|
|
|
"--concurrent-test-runs=2",
|
|
|
|
"--timeout-scale-factor=4",
|
2020-01-16 15:02:16 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2020-01-22 18:54:51 +03:00
|
|
|
"name": "h2-file",
|
2020-01-24 17:33:11 +03:00
|
|
|
"runtime_deps": [
|
|
|
|
"@maven//:com_h2database_h2",
|
|
|
|
],
|
2020-01-22 18:54:51 +03:00
|
|
|
"conformance_test_tags": [
|
|
|
|
"manual",
|
|
|
|
],
|
|
|
|
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralDirectory",
|
|
|
|
"conformance_test_server_args": [
|
|
|
|
"--jdbc-url=jdbc:h2:%DIR/test",
|
|
|
|
],
|
|
|
|
"conformance_test_tool_args": [
|
|
|
|
"--concurrent-test-runs=2",
|
|
|
|
"--timeout-scale-factor=4",
|
|
|
|
],
|
2020-01-24 17:33:11 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "postgresql",
|
2020-01-22 18:54:51 +03:00
|
|
|
"runtime_deps": [
|
2020-01-24 17:33:11 +03:00
|
|
|
"@maven//:org_postgresql_postgresql",
|
2020-01-22 18:54:51 +03:00
|
|
|
],
|
2020-01-24 17:33:11 +03:00
|
|
|
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralPostgresql",
|
2020-01-22 18:54:51 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "sqlite-memory",
|
|
|
|
"runtime_deps": [
|
|
|
|
"@maven//:org_xerial_sqlite_jdbc",
|
|
|
|
],
|
2020-01-24 17:33:11 +03:00
|
|
|
"conformance_test_server_args": [
|
2020-01-29 13:34:00 +03:00
|
|
|
"--jdbc-url=jdbc:sqlite:file:daml-on-sql-conformance-test?mode=memory&cache=shared",
|
2020-01-24 17:33:11 +03:00
|
|
|
],
|
2020-01-22 18:54:51 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "sqlite-file",
|
2020-01-24 17:33:11 +03:00
|
|
|
"runtime_deps": [
|
|
|
|
"@maven//:org_xerial_sqlite_jdbc",
|
|
|
|
],
|
2020-01-22 18:54:51 +03:00
|
|
|
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralDirectory",
|
|
|
|
"conformance_test_server_args": [
|
|
|
|
"--jdbc-url=jdbc:sqlite:%DIR/test.sqlite",
|
|
|
|
],
|
2020-01-16 15:02:16 +03:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2020-01-28 19:16:23 +03:00
|
|
|
all_database_runtime_deps = {dep: None for db in supported_databases for dep in db["runtime_deps"]}.keys()
|
|
|
|
|
2020-01-16 15:02:16 +03:00
|
|
|
da_scala_library(
|
|
|
|
name = "ledger-on-sql",
|
|
|
|
srcs = glob(["src/main/scala/**/*.scala"]),
|
|
|
|
resources = glob(["src/main/resources/**/*"]),
|
|
|
|
tags = ["maven_coordinates=com.daml.ledger:on-sql:__VERSION__"],
|
|
|
|
visibility = [
|
|
|
|
"//visibility:public",
|
|
|
|
],
|
|
|
|
runtime_deps = [
|
|
|
|
"@maven//:ch_qos_logback_logback_classic",
|
|
|
|
"@maven//:ch_qos_logback_logback_core",
|
|
|
|
"@maven//:com_h2database_h2",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
"//daml-lf/data",
|
2020-02-26 11:31:26 +03:00
|
|
|
"//language-support/scala/bindings",
|
2020-01-16 15:02:16 +03:00
|
|
|
"//ledger/ledger-api-common",
|
Sandbox & kvutils: Use the existing ledger ID if no ledger ID is specified. (#4607)
* sandbox: If the ledger ID isn't provided, use the one in the database.
Previously, we would fail if working against an existing ledger, and not
explicitly providing the ledger ID. This was the case even if the ledger
ID was randomly generated initially.
CHANGELOG_BEGIN
- [Sandbox] If no ledger ID is provided when running against an existing
ledger, use the existing ID. Previously, Sandbox would fail to start.
CHANGELOG_END
* sandbox: The ReadOnlySqlLedger should always receive a ledger ID.
It's read-only; it can't create one.
* sandbox: Stop using `equal` in SqlLedgerSpec.
* sandbox: Test that the ledger ID is as specified in SqlLedgerSpec.
* sandbox: Let the top-level runner handle a ledger ID mismatch.
And clean up the log text.
* sandbox: Initialize the ledger properly when the ID is dynamic.
* sandbox: Use `Vector`, not `List`, for SqlLedger initialization.
Append with Vector, good. List, bad.
* ledger-api-common: Make `LedgerApiMode.Dynamic` an object.
And add Java-style static factory methods.
* kvutils/app | ledger-on-{memory,sql}: Make `ledgerId` optional.
It should be generated or retrieved from the persistence layer by the
ledger itself.
* kvutils: Make the ledger ID optional in the tests.
* ledger-on-sql: Store the ledger ID, and reject conflicting IDs.
* ledger-on-sql: Make more things final.
* ledger-on-sql: Document the `ledger_meta.table_key` column better.
* sandbox: Don't hardcode the number of packages in the test DAR.
It changes.
* ledger-on-sql: Merge the `head` resource owner with the `dispatcher`.
* sandbox: Use backticks to simplify pattern match in ReadOnlySqlLedger.
* ledger-on-sql: Extract methods in `owner`.
2020-02-20 13:35:16 +03:00
|
|
|
"//ledger/ledger-api-domain",
|
2020-01-16 15:02:16 +03:00
|
|
|
"//ledger/ledger-api-health",
|
|
|
|
"//ledger/participant-state",
|
|
|
|
"//ledger/participant-state/kvutils",
|
2020-01-22 18:54:51 +03:00
|
|
|
"//libs-scala/contextualized-logging",
|
2020-01-23 18:59:01 +03:00
|
|
|
"//libs-scala/resources",
|
2020-01-16 15:02:16 +03:00
|
|
|
"@maven//:com_google_protobuf_protobuf_java",
|
|
|
|
"@maven//:com_typesafe_akka_akka_actor_2_12",
|
|
|
|
"@maven//:com_typesafe_akka_akka_stream_2_12",
|
|
|
|
"@maven//:com_typesafe_play_anorm_2_12",
|
|
|
|
"@maven//:com_typesafe_play_anorm_tokenizer_2_12",
|
|
|
|
"@maven//:com_zaxxer_HikariCP",
|
2020-01-28 19:16:23 +03:00
|
|
|
"@maven//:org_flywaydb_flyway_core",
|
Sandbox & kvutils: Use the existing ledger ID if no ledger ID is specified. (#4607)
* sandbox: If the ledger ID isn't provided, use the one in the database.
Previously, we would fail if working against an existing ledger, and not
explicitly providing the ledger ID. This was the case even if the ledger
ID was randomly generated initially.
CHANGELOG_BEGIN
- [Sandbox] If no ledger ID is provided when running against an existing
ledger, use the existing ID. Previously, Sandbox would fail to start.
CHANGELOG_END
* sandbox: The ReadOnlySqlLedger should always receive a ledger ID.
It's read-only; it can't create one.
* sandbox: Stop using `equal` in SqlLedgerSpec.
* sandbox: Test that the ledger ID is as specified in SqlLedgerSpec.
* sandbox: Let the top-level runner handle a ledger ID mismatch.
And clean up the log text.
* sandbox: Initialize the ledger properly when the ID is dynamic.
* sandbox: Use `Vector`, not `List`, for SqlLedger initialization.
Append with Vector, good. List, bad.
* ledger-api-common: Make `LedgerApiMode.Dynamic` an object.
And add Java-style static factory methods.
* kvutils/app | ledger-on-{memory,sql}: Make `ledgerId` optional.
It should be generated or retrieved from the persistence layer by the
ledger itself.
* kvutils: Make the ledger ID optional in the tests.
* ledger-on-sql: Store the ledger ID, and reject conflicting IDs.
* ledger-on-sql: Make more things final.
* ledger-on-sql: Document the `ledger_meta.table_key` column better.
* sandbox: Don't hardcode the number of packages in the test DAR.
It changes.
* ledger-on-sql: Merge the `head` resource owner with the `dispatcher`.
* sandbox: Use backticks to simplify pattern match in ReadOnlySqlLedger.
* ledger-on-sql: Extract methods in `owner`.
2020-02-20 13:35:16 +03:00
|
|
|
"@maven//:org_scalaz_scalaz_core_2_12",
|
2020-01-28 19:16:23 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-02-06 20:34:17 +03:00
|
|
|
da_scala_library(
|
|
|
|
name = "ledger-on-sql-app",
|
|
|
|
srcs = glob(["src/app/scala/**/*.scala"]),
|
|
|
|
resources = glob(["src/app/resources/**/*"]),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":ledger-on-sql",
|
|
|
|
"//daml-lf/data",
|
2020-02-26 11:31:26 +03:00
|
|
|
"//language-support/scala/bindings",
|
|
|
|
"//ledger/ledger-api-auth",
|
2020-02-06 20:34:17 +03:00
|
|
|
"//ledger/ledger-api-health",
|
|
|
|
"//ledger/participant-state",
|
|
|
|
"//ledger/participant-state/kvutils",
|
|
|
|
"//ledger/participant-state/kvutils/app",
|
2020-02-26 11:31:26 +03:00
|
|
|
"//ledger/sandbox",
|
2020-02-06 20:34:17 +03:00
|
|
|
"//libs-scala/contextualized-logging",
|
2020-03-03 11:59:15 +03:00
|
|
|
"//libs-scala/ports",
|
2020-02-06 20:34:17 +03:00
|
|
|
"//libs-scala/resources",
|
|
|
|
"@maven//:com_github_scopt_scopt_2_12",
|
|
|
|
"@maven//:com_typesafe_akka_akka_actor_2_12",
|
|
|
|
"@maven//:com_typesafe_akka_akka_stream_2_12",
|
2020-02-26 11:31:26 +03:00
|
|
|
"@maven//:io_dropwizard_metrics_metrics_core",
|
2020-02-06 20:34:17 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-01-28 19:16:23 +03:00
|
|
|
da_scala_binary(
|
|
|
|
name = "app",
|
|
|
|
main_class = "com.daml.ledger.on.sql.Main",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
runtime_deps = all_database_runtime_deps,
|
|
|
|
deps = [
|
2020-02-06 20:34:17 +03:00
|
|
|
":ledger-on-sql-app",
|
2020-01-16 15:02:16 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-01-24 17:33:11 +03:00
|
|
|
da_scala_library(
|
|
|
|
name = "ledger-on-sql-test-lib",
|
|
|
|
srcs = glob(["src/test/lib/scala/**/*.scala"]),
|
|
|
|
visibility = [
|
|
|
|
"//visibility:public",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":ledger-on-sql",
|
2020-02-06 20:34:17 +03:00
|
|
|
":ledger-on-sql-app",
|
2020-01-24 17:33:11 +03:00
|
|
|
"//daml-lf/data",
|
2020-02-26 11:31:26 +03:00
|
|
|
"//language-support/scala/bindings",
|
2020-01-28 19:16:23 +03:00
|
|
|
"//ledger-api/rs-grpc-bridge",
|
|
|
|
"//ledger-api/testing-utils",
|
2020-02-26 11:31:26 +03:00
|
|
|
"//ledger/ledger-api-auth",
|
2020-01-24 17:33:11 +03:00
|
|
|
"//ledger/ledger-api-health",
|
|
|
|
"//ledger/participant-state",
|
|
|
|
"//ledger/participant-state/kvutils",
|
2020-01-28 19:16:23 +03:00
|
|
|
"//ledger/participant-state/kvutils:kvutils-tests-lib",
|
2020-01-24 17:33:11 +03:00
|
|
|
"//ledger/participant-state/kvutils/app",
|
2020-02-26 11:31:26 +03:00
|
|
|
"//ledger/sandbox",
|
2020-01-28 19:16:23 +03:00
|
|
|
"//libs-scala/contextualized-logging",
|
2020-03-03 11:59:15 +03:00
|
|
|
"//libs-scala/ports",
|
2020-01-24 17:33:11 +03:00
|
|
|
"//libs-scala/postgresql-testing",
|
|
|
|
"//libs-scala/resources",
|
|
|
|
"@maven//:com_github_scopt_scopt_2_12",
|
2020-01-28 19:16:23 +03:00
|
|
|
"@maven//:com_typesafe_akka_akka_actor_2_12",
|
2020-01-24 17:33:11 +03:00
|
|
|
"@maven//:com_typesafe_akka_akka_stream_2_12",
|
2020-02-26 11:31:26 +03:00
|
|
|
"@maven//:io_dropwizard_metrics_metrics_core",
|
2020-01-28 19:16:23 +03:00
|
|
|
"@maven//:org_scalactic_scalactic_2_12",
|
|
|
|
"@maven//:org_scalatest_scalatest_2_12",
|
2020-01-24 17:33:11 +03:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
da_scala_test_suite(
|
2020-01-16 15:02:16 +03:00
|
|
|
name = "ledger-on-sql-tests",
|
|
|
|
srcs = glob(["src/test/suite/**/*.scala"]),
|
|
|
|
data = [
|
|
|
|
"//ledger/test-common:Test-stable.dar",
|
|
|
|
],
|
|
|
|
resources = glob(["src/test/resources/*"]),
|
2020-01-28 19:16:23 +03:00
|
|
|
runtime_deps = all_database_runtime_deps,
|
2020-01-16 15:02:16 +03:00
|
|
|
deps = [
|
|
|
|
":ledger-on-sql",
|
2020-01-28 19:16:23 +03:00
|
|
|
":ledger-on-sql-test-lib",
|
2020-01-16 15:02:16 +03:00
|
|
|
"//daml-lf/data",
|
|
|
|
"//ledger-api/rs-grpc-bridge",
|
|
|
|
"//ledger-api/testing-utils",
|
|
|
|
"//ledger/ledger-api-common",
|
|
|
|
"//ledger/ledger-api-health",
|
|
|
|
"//ledger/participant-state",
|
|
|
|
"//ledger/participant-state/kvutils",
|
|
|
|
"//ledger/participant-state/kvutils:kvutils-tests-lib",
|
2020-01-29 13:34:00 +03:00
|
|
|
"//libs-scala/contextualized-logging",
|
2020-01-24 17:33:11 +03:00
|
|
|
"//libs-scala/postgresql-testing",
|
2020-01-23 18:59:01 +03:00
|
|
|
"//libs-scala/resources",
|
2020-01-16 15:02:16 +03:00
|
|
|
"@maven//:com_typesafe_akka_akka_actor_2_12",
|
|
|
|
"@maven//:com_typesafe_akka_akka_stream_2_12",
|
2020-01-28 19:16:23 +03:00
|
|
|
"@maven//:org_flywaydb_flyway_core",
|
2020-01-30 13:16:32 +03:00
|
|
|
"@maven//:org_scala_lang_modules_scala_java8_compat_2_12",
|
2020-01-16 15:02:16 +03:00
|
|
|
"@maven//:org_scalactic_scalactic_2_12",
|
|
|
|
"@maven//:org_scalatest_scalatest_2_12",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
[
|
|
|
|
(
|
|
|
|
da_scala_binary(
|
|
|
|
name = "conformance-test-{}-bin".format(db["name"]),
|
|
|
|
main_class = db.get("conformance_test_server_main", "com.daml.ledger.on.sql.Main"),
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
runtime_deps = db.get("runtime_deps", []),
|
|
|
|
deps = [
|
|
|
|
":ledger-on-sql",
|
2020-01-24 17:33:11 +03:00
|
|
|
":ledger-on-sql-test-lib",
|
2020-01-16 15:02:16 +03:00
|
|
|
],
|
|
|
|
),
|
|
|
|
conformance_test(
|
|
|
|
name = "conformance-test-{}".format(db["name"]),
|
|
|
|
ports = [6865],
|
|
|
|
server = ":conformance-test-{}-bin".format(db["name"]),
|
2020-03-02 19:50:38 +03:00
|
|
|
server_args = [
|
|
|
|
"--contract-id-seeding=weak",
|
|
|
|
"--participant participant-id=conformance-test,port=6865",
|
|
|
|
] + db.get("conformance_test_server_args", []),
|
2020-01-16 15:02:16 +03:00
|
|
|
tags = db.get("conformance_test_tags", []),
|
2020-01-22 18:54:51 +03:00
|
|
|
test_tool_args = db.get("conformance_test_tool_args", []) + [
|
2020-02-26 17:45:35 +03:00
|
|
|
"--verbose",
|
2020-01-16 15:02:16 +03:00
|
|
|
"--all-tests",
|
|
|
|
"--exclude=ConfigManagementServiceIT",
|
2020-02-26 14:00:02 +03:00
|
|
|
"--exclude=CommandDeduplicationIT",
|
2020-01-29 12:30:49 +03:00
|
|
|
],
|
|
|
|
),
|
|
|
|
conformance_test(
|
|
|
|
name = "conformance-test-config-management-{}".format(db["name"]),
|
|
|
|
ports = [6865],
|
|
|
|
server = ":conformance-test-{}-bin".format(db["name"]),
|
2020-03-02 19:50:38 +03:00
|
|
|
server_args = [
|
|
|
|
"--contract-id-seeding=weak",
|
|
|
|
"--participant participant-id=conformance-test,port=6865",
|
|
|
|
] + db.get("conformance_test_server_args", []),
|
2020-01-29 12:30:49 +03:00
|
|
|
tags = db.get("conformance_test_tags", []),
|
|
|
|
test_tool_args = db.get("conformance_test_tool_args", []) + [
|
2020-02-26 17:45:35 +03:00
|
|
|
"--verbose",
|
2020-01-29 12:30:49 +03:00
|
|
|
"--include=ConfigManagementServiceIT",
|
2020-01-16 15:02:16 +03:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
for db in supported_databases
|
|
|
|
]
|