split //daml-lf/valiation/upgrade-tests (#19208)

this should reduce flakyness and running time
This commit is contained in:
Remy 2024-05-15 15:39:24 +02:00 committed by GitHub
parent 317b6b2057
commit 0b0f842d47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 94 additions and 47 deletions

View File

@ -1,6 +1,7 @@
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("@os_info//:os_info.bzl", "is_intel", "is_windows")
load(
"//bazel_tools:scala.bzl",
"da_scala_benchmark_jmh",
@ -11,7 +12,6 @@ load(
"lf_scalacopts",
"lf_scalacopts_stricter",
)
load("@os_info//:os_info.bzl", "is_intel", "is_windows")
da_scala_library(
name = "validation",
@ -52,26 +52,44 @@ da_scala_library(
name = "upgrade-test-lib",
srcs =
glob(
["src/test/**/UpgradesSpecUtil.scala"],
[
"src/test/scala/**/upgrade/UpgradesSpecBase.scala",
"src/test/scala/**/upgrade/UpgradesSpecUtil.scala",
],
) +
# we depend on sources to avoid pushing a canton artifact to maven
[
"//canton:community_admin-api_proto_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_apache_pekko_pekko_actor",
"@maven//:org_apache_pekko_pekko_stream",
],
scaladoc = False,
visibility = ["//visibility:public"],
deps = [
"//bazel_tools/runfiles:scala_runfiles",
"//canton:community_admin-api",
"//canton:community_ledger_ledger-common",
"//canton:ledger_api_proto_scala",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//libs-scala/ledger-resources",
"//libs-scala/ports",
"//libs-scala/resources",
"//libs-scala/rs-grpc-bridge",
"//libs-scala/testing-utils",
"//test-common/canton/it-lib",
"@maven//:io_grpc_grpc_netty",
"@maven//:org_scalatest_scalatest_compatible",
],
)
upgrade_test_file = "src/test/scala/com/daml/lf/validation/UpgradesSpec.scala"
da_scala_test_suite(
name = "tests",
size = "large",
@ -79,12 +97,12 @@ da_scala_test_suite(
["src/test/**/*.scala"],
exclude = [
"src/test/**/*SpecUtil.scala",
upgrade_test_file,
"src/test/**/*SpecUtil.scala",
"src/test/**/upgrade/*",
],
),
data = [],
scala_deps = [
],
scala_deps = [],
scalacopts = lf_scalacopts,
deps = [
":validation",
@ -98,10 +116,16 @@ da_scala_test_suite(
# TODO https://github.com/digital-asset/daml/issues/17254
# this test should not use canton and be part of the suite above
[
da_scala_test(
da_scala_test_suite(
name = "upgrade-tests",
size = "medium",
srcs = [upgrade_test_file],
size = "large",
srcs = glob(
["src/test/**/upgrade/*.scala"],
exclude = [
"src/test/scala/**/upgrade/UpgradesSpecBase.scala",
"src/test/scala/**/upgrade/UpgradesSpecUtil.scala",
],
),
data = [
"//test-common:dar-files-default",
"//test-common:upgrades-CommonVersionFailure-v1a.dar",
@ -215,17 +239,13 @@ da_scala_test_suite(
scalacopts = lf_scalacopts,
deps = [
":upgrade-test-lib",
"//bazel_tools/runfiles:scala_runfiles",
"//canton:community_ledger_ledger-common",
"//canton:ledger_api_proto_scala",
"//daml-lf/archive:daml_lf_archive_reader",
"//daml-lf/data",
"//libs-scala/ledger-resources",
"//libs-scala/ports",
"//libs-scala/resources",
"//libs-scala/rs-grpc-bridge",
"//libs-scala/testing-utils",
"//test-common/canton/it-lib",
"@maven//:com_google_protobuf_protobuf_java",
],
),
] if is_intel and not is_windows else []

View File

@ -0,0 +1,11 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.validation
package upgrade
class UpgradesSpecAdminAPIDryRun
extends UpgradesSpecAdminAPI("Admin API with dry run")
with LongTests {
override val uploadSecondPackageDryRun = true;
}

View File

@ -0,0 +1,9 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.validation
package upgrade
class UpgradesSpecAdminAPIWithValidation
extends UpgradesSpecAdminAPI("Admin API with validation")
with LongTests

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.validation
package upgrade
import com.daml.integrationtest.CantonFixture
import org.scalatest.Inside
@ -24,38 +25,6 @@ import scala.util.{Success, Failure}
import org.scalatest.Inspectors.forEvery
import scala.util.Using
class UpgradesSpecAdminAPIWithoutValidation
extends UpgradesSpecAdminAPI("Admin API without validation")
with ShortTests {
override val disableUpgradeValidation = true;
}
class UpgradesSpecLedgerAPIWithoutValidation
extends UpgradesSpecLedgerAPI("Ledger API without validation")
with ShortTests {
override val disableUpgradeValidation = true;
}
class UpgradesSpecAdminAPIDryRun
extends UpgradesSpecAdminAPI("Admin API with dry run")
with LongTests {
override val uploadSecondPackageDryRun = true;
}
class UpgradesSpecLedgerAPIDryRun
extends UpgradesSpecLedgerAPI("Ledger API with dry run")
with LongTests {
override val uploadSecondPackageDryRun = true;
}
class UpgradesSpecAdminAPIWithValidation
extends UpgradesSpecAdminAPI("Admin API with validation")
with LongTests
class UpgradesSpecLedgerAPIWithValidation
extends UpgradesSpecLedgerAPI("Ledger API with validation")
with LongTests
abstract class UpgradesSpecAdminAPI(override val suffix: String) extends UpgradesSpec(suffix) {
override def uploadPackage(
path: String,

View File

@ -0,0 +1,11 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.validation
package upgrade
class UpgradesSpecLedgerAPIDryRun
extends UpgradesSpecLedgerAPI("Ledger API with dry run")
with LongTests {
override val uploadSecondPackageDryRun = true;
}

View File

@ -0,0 +1,9 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.validation
package upgrade
class UpgradesSpecLedgerAPIWithValidation
extends UpgradesSpecLedgerAPI("Ledger API with validation")
with LongTests

View File

@ -0,0 +1,17 @@
// Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.lf.validation
package upgrade
class UpgradesSpecAdminAPIWithoutValidation
extends UpgradesSpecAdminAPI("Admin API without validation")
with ShortTests {
override val disableUpgradeValidation = true;
}
class UpgradesSpecLedgerAPIWithoutValidation
extends UpgradesSpecLedgerAPI("Ledger API without validation")
with ShortTests {
override val disableUpgradeValidation = true;
}

View File

@ -5,6 +5,7 @@
// We should intend to replace this as soon as possible
package com.daml.lf.validation
package upgrade
import com.digitalasset.canton.ledger.client.LedgerCallCredentials.authenticatingStub
import com.digitalasset.canton.ledger.client.GrpcChannel