Skip to content

Commit

Permalink
Fix flaky CMConcurrentSetConflicting conformance test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nmarton-da committed May 20, 2021
1 parent 3827f82 commit b275768
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions ledger/ledger-api-test-tool/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
)
}
}
})

Expand Down

0 comments on commit b275768

Please sign in to comment.