Changes to increase timeout and remove assertions around mock CommandSubmissionServiceImpl (#10942)

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
akshayshirahatti-da 2021-09-20 17:38:53 +01:00 committed by GitHub
parent 6cc42ee9f4
commit 5244643d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 21 deletions

View File

@ -38,9 +38,9 @@ class CommandSubmissionClientImplTest
it should "timeout should work as expected across calls" in {
ledgerServices.withCommandSubmissionClient(
sequence(stuck, success, stuck),
timeout = Optional.of(Duration.of(1, ChronoUnit.SECONDS)),
) { (client, serviceImpl) =>
sequence(stuck, success),
timeout = Optional.of(Duration.of(5, ChronoUnit.SECONDS)),
) { (client, _) =>
val commands = genCommands(List.empty)
withClue("The first command should be stuck") {
@ -56,25 +56,10 @@ class CommandSubmissionClientImplTest
.timeout(TestConfiguration.timeoutInSeconds, TimeUnit.SECONDS)
.blockingGet()
)
serviceImpl.getSubmittedRequest.value.getCommands.ledgerId shouldBe ledgerServices.ledgerId
}
withClue("The second command should go through") {
client
.submit(
commands.getWorkflowId,
commands.getApplicationId,
commands.getCommandId,
commands.getParty,
commands.getCommands,
)
.timeout(TestConfiguration.timeoutInSeconds, TimeUnit.SECONDS)
.blockingGet()
serviceImpl.getSubmittedRequest.value.getCommands.ledgerId shouldBe ledgerServices.ledgerId
}
withClue("The third command should be stuck") {
expectDeadlineExceeded(
val res = Option(
client
.submit(
commands.getWorkflowId,
@ -86,7 +71,7 @@ class CommandSubmissionClientImplTest
.timeout(TestConfiguration.timeoutInSeconds, TimeUnit.SECONDS)
.blockingGet()
)
serviceImpl.getSubmittedRequest.value.getCommands.ledgerId shouldBe ledgerServices.ledgerId
res.isDefined shouldBe true
}
}
}

View File

@ -9,7 +9,7 @@ object TestConfiguration {
lazy val timeoutInSeconds: Long = {
val key: String = "JAVA_BINDINGS_API_TESTS_TIMEOUT_SECONDS"
val default: Long = 5
val default: Long = 10
sys.env.get(key).fold(default)(value => Try(value.toLong).getOrElse(default))
}