Added test for new case.

This commit is contained in:
Miklos Erdelyi 2021-09-03 10:46:39 +02:00
parent 16a42eaf29
commit 8ef4364f7a
2 changed files with 23 additions and 1 deletions

View File

@ -343,9 +343,11 @@ object KeyValueConsumption {
),
)
)
case _ if deduplicated =>
//drop all other duplicate submissions
// We only emit updates for duplicate transaction submissions.
None
case DamlLogEntry.PayloadCase.TRANSACTION_REJECTION_ENTRY if invalidRecordTime =>
val transactionRejectionEntry = wrappedLogEntry.getTransactionRejectionEntry
val reason = (timeBounds.tooEarlyUntil, timeBounds.tooLateFrom) match {

View File

@ -182,6 +182,26 @@ class KeyValueConsumptionSpec extends AnyWordSpec with Matchers {
runAll(testCases)
}
"generate a rejection entry for a transaction if its submission has been deduplicated" in {
val inputEntry = {
val builder = DamlOutOfTimeBoundsEntry.newBuilder
builder.setDuplicateUntil(buildTimestamp(aRecordTimeInstant.plusMillis(1)))
builder.setEntry(buildLogEntry(TRANSACTION_REJECTION_ENTRY))
builder.build
}
outOfTimeBoundsEntryToUpdate(aRecordTime, inputEntry) match {
case Some(Update.CommandRejected(recordTime, completionInfo, FinalReason(status))) =>
recordTime shouldBe aRecordTime
completionInfo shouldBe Conversions.parseCompletionInfo(
parseInstant(recordTime),
someSubmitterInfo,
)
status.code shouldBe Code.ALREADY_EXISTS.value
()
case _ => fail()
}
}
"generate a rejection entry for a configuration if record time is out of time bounds" in {
def verifyConfigurationRejection(actual: Option[Update]): Unit = actual match {
case Some(