-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ledger-api-test-tool: Add assertions and a test case for successful c…
…ompletions when converting deduplication durations to offsets [KVL-1220] (#12462) CHANGELOG_BEGIN CHANGELOG_END
- Loading branch information
Showing
10 changed files
with
237 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ate/kvutils/deduplication/HexOffset.scala → ...platform/participant/util/HexOffset.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...kvutils/deduplication/HexOffsetSpec.scala → ...form/participant/util/HexOffsetSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/time/DelayMechanism.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.ledger.api.testtool.infrastructure.time | ||
|
||
import com.daml.ledger.api.testtool.infrastructure.participant.ParticipantTestContext | ||
import com.daml.timer.Delayed | ||
|
||
import scala.concurrent.{ExecutionContext, Future} | ||
import scala.concurrent.duration.{Duration, FiniteDuration} | ||
|
||
trait DelayMechanism { | ||
val skews: FiniteDuration | ||
def delayBy(duration: Duration): Future[Unit] | ||
} | ||
|
||
class TimeDelayMechanism(val skews: FiniteDuration)(implicit ec: ExecutionContext) | ||
extends DelayMechanism { | ||
override def delayBy(duration: Duration): Future[Unit] = Delayed.by(duration)(()) | ||
} | ||
|
||
class StaticTimeDelayMechanism(ledger: ParticipantTestContext, val skews: FiniteDuration)(implicit | ||
ec: ExecutionContext | ||
) extends DelayMechanism { | ||
override def delayBy(duration: Duration): Future[Unit] = | ||
ledger | ||
.time() | ||
.flatMap { currentTime => | ||
ledger.setTime(currentTime, currentTime.plusMillis(duration.toMillis)) | ||
} | ||
} |
Oops, something went wrong.