From b275768d26de4689ed208530d083469a5d4f5fe6 Mon Sep 17 00:00:00 2001 From: Marton Nagy Date: Thu, 20 May 2021 21:48:32 +0200 Subject: [PATCH] Fix flaky CMConcurrentSetConflicting conformance test By relaxing the assertion to two possible GRPC error codes. Also adds dependency of libs-scala/grpc-utils to test suites. changelog_begin changelog_end --- ledger/ledger-api-test-tool/BUILD.bazel | 1 + .../suites/ConfigManagementServiceIT.scala | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ledger/ledger-api-test-tool/BUILD.bazel b/ledger/ledger-api-test-tool/BUILD.bazel index 16328e70e8cf..1612144e7017 100644 --- a/ledger/ledger-api-test-tool/BUILD.bazel +++ b/ledger/ledger-api-test-tool/BUILD.bazel @@ -131,6 +131,7 @@ da_scala_binary( "//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", diff --git a/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ConfigManagementServiceIT.scala b/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ConfigManagementServiceIT.scala index d1783ee1c255..e1382541e519 100644 --- a/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ConfigManagementServiceIT.scala +++ b/ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/suites/ConfigManagementServiceIT.scala @@ -3,6 +3,7 @@ package com.daml.ledger.api.testtool.suites +import com.daml.grpc.{GrpcException, GrpcStatus} import com.daml.ledger.api.testtool.infrastructure.Allocation._ import com.daml.ledger.api.testtool.infrastructure.Assertions._ import com.daml.ledger.api.testtool.infrastructure.LedgerTestSuite @@ -158,7 +159,21 @@ final class ConfigManagementServiceIT extends LedgerTestSuite { response1.configurationGeneration + 1 == response2.configurationGeneration, s"New configuration's generation (${response2.configurationGeneration} should be original configurations's generation (${response1.configurationGeneration} + 1) )", ) - assertGrpcError(failure, Status.Code.ABORTED, "") + failure match { + case GrpcException(GrpcStatus(Status.Code.ABORTED, _), _) => + () // if the "looser" command fails after command submission (the winner completed after looser did submit the configuration change) + + case GrpcException(GrpcStatus(Status.Code.INVALID_ARGUMENT, _), _) => + () // if the "looser" command fails already on command submission (the winner completed before looser submission is over) + + case GrpcException(GrpcStatus(notExpectedCode, _), _) => + fail(s"One of the submissions failed with an unexpected status code: $notExpectedCode") + + case notExpectedException => + fail( + s"Unexpected exception: type:${notExpectedException.getClass.getName}, message:${notExpectedException.getMessage}" + ) + } } })