Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,11 @@ object SpliceTests extends LazyLogging {
def eventuallySucceeds[T](
timeUntilSuccess: FiniteDuration = 20.seconds,
maxPollInterval: FiniteDuration = 5.seconds,
suppressErrors: Boolean = true,
)(testCode: => T): T = {
eventually(timeUntilSuccess, maxPollInterval) {
try {
loggerFactory.suppressErrors(testCode)
if (suppressErrors) loggerFactory.suppressErrors(testCode) else testCode
} catch {
case e: TestFailedException => throw e
case NonFatal(e) => fail(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ trait PreflightIntegrationTestUtil extends TestCommon {
override def eventuallySucceeds[T](
timeUntilSuccess: FiniteDuration = this.preflightTimeUntilSuccess,
maxPollInterval: FiniteDuration = 5.seconds,
)(testCode: => T): T = super.eventuallySucceeds(timeUntilSuccess, maxPollInterval)(testCode)
suppressErrors: Boolean = true,
)(testCode: => T): T =
super.eventuallySucceeds(timeUntilSuccess, maxPollInterval, suppressErrors)(testCode)

override def actAndCheck[T, U](
timeUntilSuccess: FiniteDuration = this.preflightTimeUntilSuccess,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ abstract class ValidatorPreflightIntegrationTestBase
limitValidatorUsers()
}

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

protected def limitValidatorUsers() = {
val client: ValidatorAppClientReference = validatorClient
val users = eventuallySucceeds()(client.listUsers())
val users = eventuallySucceeds()(validatorClient(suppressErrors = false).listUsers())
val targetNumber = 40 // TODO(tech-debt): consider de-hardcoding this
val offboardThreshold = 50 // TODO(tech-debt): consider de-hardcoding this
if (users.length > offboardThreshold) {
Expand All @@ -120,7 +119,7 @@ abstract class ValidatorPreflightIntegrationTestBase
.foreach { user =>
{
logger.debug(s"Offboarding user: ${user}")
eventuallySucceeds()(validatorClient.offboardUser(user))
eventuallySucceeds()(validatorClient(suppressErrors = false).offboardUser(user))
}
}
} else {
Expand Down Expand Up @@ -230,7 +229,7 @@ abstract class ValidatorPreflightIntegrationTestBase
}

clue("Onboard charlie manually to share a party with Bob") {
validatorClient.onboardUser(charlieUser.id, Some(PartyId.tryFromProtoPrimitive(bobPartyId)))
validatorClient().onboardUser(charlieUser.id, Some(PartyId.tryFromProtoPrimitive(bobPartyId)))
}

withFrontEnd("charlie-validator") { implicit webDriver =>
Expand Down Expand Up @@ -399,7 +398,7 @@ abstract class ValidatorPreflightIntegrationTestBase
}

"can dump participant identities of validator" in { _ =>
validatorClient.dumpParticipantIdentities()
validatorClient().dumpParticipantIdentities()
}

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

val domainConnectionConfig = validatorClient.decentralizedSynchronizerConnectionConfig()
val domainConnectionConfig = validatorClient().decentralizedSynchronizerConnectionConfig()
val connectedEndpointSet =
domainConnectionConfig.sequencerConnections.connections.flatMap(_.endpoints).toSet

Expand Down Expand Up @@ -536,7 +535,7 @@ class RunbookValidatorPreflightIntegrationTest extends ValidatorPreflightIntegra
val (svSequencerEndpoint, _) = Endpoint
.fromUris(NonEmpty.from(Seq(new URI(domainConfig.sequencer.toScala.value.url))).value)
.value
val domainConnectionConfig = validatorClient.decentralizedSynchronizerConnectionConfig()
val domainConnectionConfig = validatorClient().decentralizedSynchronizerConnectionConfig()
val connectedEndpointSet =
domainConnectionConfig.sequencerConnections.connections.flatMap(_.endpoints).toSet
connectedEndpointSet should contain(svSequencerEndpoint.forgetNE.loneElement.toString)
Expand Down
Loading