mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
6bf0996bf1
* Add basic Sandbox data continuity tests This adds some basic tests that check that data migrations work properly. For now, I use DAML Script to create and query contracts at each step. This isn’t perfect since queries can only use the active contract service but not things like the transaction stream but it’s clearly better than nothing. The runner for executing the tests is a simple Haskell executable. It didn’t really seem useful to throw tasty at this. I’ve added two sets of tests, one that runs only through stable versions and one that includes snapshots since migrating through snapshots is not necessarily equivalent. Sadly these tests use sandbox-classic since I discovered while writing these tests that sandbox-next does not actually support migrating data between SDK versions. changelog_begin changelog_end * Use the sandbox module instead of a custom withSandbox changelog_begin changelog_end * Update compatibility/sandbox-migration/SandboxMigrationRunner.hs Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com> Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
100 lines
2.5 KiB
Python
100 lines
2.5 KiB
Python
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
load("@bazel_skylib//lib:versions.bzl", "versions")
|
|
load("@os_info//:os_info.bzl", "is_windows")
|
|
load("//bazel_tools:testing.bzl", "sdk_platform_test")
|
|
load(
|
|
"//bazel_tools/daml_script:daml_script.bzl",
|
|
"daml_script_dar",
|
|
"daml_script_test",
|
|
)
|
|
load("//sandbox-migration:util.bzl", "migration_test")
|
|
|
|
config_setting(
|
|
name = "ghci_data",
|
|
define_values = {
|
|
"ghci_data": "True",
|
|
},
|
|
)
|
|
|
|
sdk_versions = [
|
|
"1.0.0",
|
|
"1.0.1-snapshot.20200417.3908.1.722bac90",
|
|
"1.1.0-snapshot.20200422.3991.0.6391ee9f",
|
|
"0.0.0",
|
|
]
|
|
|
|
platform_versions = [
|
|
"1.0.0",
|
|
"1.0.1-snapshot.20200417.3908.1.722bac90",
|
|
"1.1.0-snapshot.20200422.3991.0.6391ee9f",
|
|
"0.0.0",
|
|
]
|
|
|
|
# TODO Generate this automatically.
|
|
stable_platform_versions = [
|
|
"1.0.0",
|
|
"0.0.0",
|
|
]
|
|
|
|
[
|
|
sh_binary(
|
|
name = "sandbox-with-postgres-{}".format(version),
|
|
srcs = ["@//bazel_tools:sandbox-with-postgres.sh"],
|
|
data = [
|
|
"@//bazel_tools/client_server/with-postgres:with-postgres-exe",
|
|
"@daml-sdk-{}//:daml".format(version),
|
|
],
|
|
deps = ["@bazel_tools//tools/bash/runfiles"],
|
|
)
|
|
for version in platform_versions
|
|
]
|
|
|
|
[
|
|
sdk_platform_test(
|
|
platform_version = platform_version,
|
|
sdk_version = sdk_version,
|
|
)
|
|
for sdk_version in sdk_versions
|
|
for platform_version in platform_versions
|
|
]
|
|
|
|
[
|
|
daml_script_dar(sdk_version)
|
|
for sdk_version in sdk_versions
|
|
]
|
|
|
|
[
|
|
daml_script_test(
|
|
compiler_version = sdk_version,
|
|
runner_version = platform_version,
|
|
)
|
|
for sdk_version in sdk_versions
|
|
for platform_version in platform_versions
|
|
# Test that the DAML script runner can run DARs built with an older SDK
|
|
# version. I.e. where the runner version is at least the SDK version or
|
|
# more recent. The HEAD version 0.0.0 is a special case.
|
|
if versions.is_at_least(sdk_version, platform_version) and sdk_version != "0.0.0" or
|
|
platform_version == "0.0.0"
|
|
]
|
|
|
|
test_suite(
|
|
name = "head-quick",
|
|
tags = ["head-quick"],
|
|
)
|
|
|
|
# We have two migration tests: migration-stable runs through all stable releases
|
|
# including current HEAD. migration-all includes snapshot releases.
|
|
|
|
migration_test(
|
|
name = "migration-stable",
|
|
tags = ["head-quick"],
|
|
versions = stable_platform_versions,
|
|
) if not is_windows else None
|
|
|
|
migration_test(
|
|
name = "migration-all",
|
|
versions = platform_versions,
|
|
) if not is_windows else None
|