Skip to content

Commit 1535532

Browse files
Update ValidatorPreflightIntegrationTest with fix (#1159)
Signed-off-by: Julien Tinguely <julien.tinguely@digitalasset.com>
1 parent 03b4558 commit 1535532

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/SpliceTests.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,11 @@ object SpliceTests extends LazyLogging {
511511
def eventuallySucceeds[T](
512512
timeUntilSuccess: FiniteDuration = 20.seconds,
513513
maxPollInterval: FiniteDuration = 5.seconds,
514+
suppressErrors: Boolean = true,
514515
)(testCode: => T): T = {
515516
eventually(timeUntilSuccess, maxPollInterval) {
516517
try {
517-
loggerFactory.suppressErrors(testCode)
518+
if (suppressErrors) loggerFactory.suppressErrors(testCode) else testCode
518519
} catch {
519520
case e: TestFailedException => throw e
520521
case NonFatal(e) => fail(e)

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/runbook/PreflightIntegrationTestUtil.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ trait PreflightIntegrationTestUtil extends TestCommon {
2020
override def eventuallySucceeds[T](
2121
timeUntilSuccess: FiniteDuration = this.preflightTimeUntilSuccess,
2222
maxPollInterval: FiniteDuration = 5.seconds,
23-
)(testCode: => T): T = super.eventuallySucceeds(timeUntilSuccess, maxPollInterval)(testCode)
23+
suppressErrors: Boolean = true,
24+
)(testCode: => T): T =
25+
super.eventuallySucceeds(timeUntilSuccess, maxPollInterval, suppressErrors)(testCode)
2426

2527
override def actAndCheck[T, U](
2628
timeUntilSuccess: FiniteDuration = this.preflightTimeUntilSuccess,

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/tests/runbook/ValidatorPreflightIntegrationTest.scala

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ abstract class ValidatorPreflightIntegrationTestBase
9191
limitValidatorUsers()
9292
}
9393

94-
protected def validatorClient: ValidatorAppClientReference = {
94+
protected def validatorClient(suppressErrors: Boolean = true): ValidatorAppClientReference = {
9595
val env = provideEnvironment("NotUsed")
9696
// retry on e.g. network errors and rate limits
97-
val token = eventuallySucceeds() {
97+
val token = eventuallySucceeds(suppressErrors = suppressErrors) {
9898
Auth0Util.getAuth0ClientCredential(
9999
validatorAuth0Secret,
100100
validatorAuth0Audience,
@@ -106,8 +106,7 @@ abstract class ValidatorPreflightIntegrationTestBase
106106
}
107107

108108
protected def limitValidatorUsers() = {
109-
val client: ValidatorAppClientReference = validatorClient
110-
val users = eventuallySucceeds()(client.listUsers())
109+
val users = eventuallySucceeds()(validatorClient(suppressErrors = false).listUsers())
111110
val targetNumber = 40 // TODO(tech-debt): consider de-hardcoding this
112111
val offboardThreshold = 50 // TODO(tech-debt): consider de-hardcoding this
113112
if (users.length > offboardThreshold) {
@@ -120,7 +119,7 @@ abstract class ValidatorPreflightIntegrationTestBase
120119
.foreach { user =>
121120
{
122121
logger.debug(s"Offboarding user: ${user}")
123-
eventuallySucceeds()(validatorClient.offboardUser(user))
122+
eventuallySucceeds()(validatorClient(suppressErrors = false).offboardUser(user))
124123
}
125124
}
126125
} else {
@@ -230,7 +229,7 @@ abstract class ValidatorPreflightIntegrationTestBase
230229
}
231230

232231
clue("Onboard charlie manually to share a party with Bob") {
233-
validatorClient.onboardUser(charlieUser.id, Some(PartyId.tryFromProtoPrimitive(bobPartyId)))
232+
validatorClient().onboardUser(charlieUser.id, Some(PartyId.tryFromProtoPrimitive(bobPartyId)))
234233
}
235234

236235
withFrontEnd("charlie-validator") { implicit webDriver =>
@@ -399,7 +398,7 @@ abstract class ValidatorPreflightIntegrationTestBase
399398
}
400399

401400
"can dump participant identities of validator" in { _ =>
402-
validatorClient.dumpParticipantIdentities()
401+
validatorClient().dumpParticipantIdentities()
403402
}
404403

405404
"connect to all sequencers stated in latest DsoRules contract" in { implicit env =>
@@ -421,7 +420,7 @@ abstract class ValidatorPreflightIntegrationTestBase
421420
.fromUris(NonEmpty.from(availableConnections.map(conn => new URI(conn.url))).value)
422421
.value
423422

424-
val domainConnectionConfig = validatorClient.decentralizedSynchronizerConnectionConfig()
423+
val domainConnectionConfig = validatorClient().decentralizedSynchronizerConnectionConfig()
425424
val connectedEndpointSet =
426425
domainConnectionConfig.sequencerConnections.connections.flatMap(_.endpoints).toSet
427426

@@ -536,7 +535,7 @@ class RunbookValidatorPreflightIntegrationTest extends ValidatorPreflightIntegra
536535
val (svSequencerEndpoint, _) = Endpoint
537536
.fromUris(NonEmpty.from(Seq(new URI(domainConfig.sequencer.toScala.value.url))).value)
538537
.value
539-
val domainConnectionConfig = validatorClient.decentralizedSynchronizerConnectionConfig()
538+
val domainConnectionConfig = validatorClient().decentralizedSynchronizerConnectionConfig()
540539
val connectedEndpointSet =
541540
domainConnectionConfig.sequencerConnections.connections.flatMap(_.endpoints).toSet
542541
connectedEndpointSet should contain(svSequencerEndpoint.forgetNE.loneElement.toString)

0 commit comments

Comments
 (0)