mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
Fix flaky ApiConfigManagementServiceSpec test (#10922)
* Fix flaky ApiConfigManagementServiceSpec test. CHANGELOG_BEGIN CHANGELOG_END * format code
This commit is contained in:
parent
50291ed61b
commit
d01f8e1c35
@ -38,7 +38,8 @@ import org.scalatest.matchers.should.Matchers
|
||||
import org.scalatest.wordspec.AsyncWordSpec
|
||||
|
||||
import scala.collection.immutable
|
||||
import scala.concurrent.Future
|
||||
import scala.concurrent.{Await, Future, Promise}
|
||||
import scala.concurrent.duration.{Duration => ScalaDuration}
|
||||
import scala.util.{Failure, Success}
|
||||
|
||||
class ApiConfigManagementServiceSpec
|
||||
@ -321,16 +322,19 @@ object ApiConfigManagementServiceSpec {
|
||||
val currentConfiguration =
|
||||
new AtomicReference[Option[(LedgerOffset.Absolute, Configuration)]](None)
|
||||
|
||||
val indexService = new IndexConfigManagementService {
|
||||
val indexService: IndexConfigManagementService = new IndexConfigManagementService {
|
||||
private val atLeastOneConfig = Promise[Unit]()
|
||||
private val source = configurationSource
|
||||
.map { case (offset, submissionId, configuration) =>
|
||||
val ledgerOffset =
|
||||
LedgerOffset.Absolute(Ref.LedgerString.assertFromString(offset.toString))
|
||||
currentConfiguration.set(Some(ledgerOffset -> configuration))
|
||||
atLeastOneConfig.trySuccess(())
|
||||
val entry = ConfigurationEntry.Accepted(submissionId, configuration)
|
||||
ledgerOffset -> entry
|
||||
}
|
||||
.preMaterialize()
|
||||
Await.result(atLeastOneConfig.future, ScalaDuration.Inf)
|
||||
|
||||
override def lookupConfiguration()(implicit
|
||||
loggingContext: LoggingContext
|
||||
|
Loading…
Reference in New Issue
Block a user