Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test tool party flakiness fix #3841

Merged
merged 4 commits into from
Dec 13, 2019
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
1 change: 0 additions & 1 deletion ledger/ledger-api-test-tool-on-canton/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,4 @@ conformance_test(
5021,
],
server = ":canton-test-runner-with-dependencies",
tags = ["manual"],
) if not is_windows else None
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,8 @@ private[testtool] final class LedgerTestContext private[infrastructure] (

private[this] def waitForParties(
participant: ParticipantTestContext,
expectedParties: Set[Party]): Future[Unit] = {
Future
.sequence(participants.map(otherParticipant => {
otherParticipant
.listParties()
.map(actualParties => {
assert(
expectedParties.subsetOf(actualParties),
s"Parties from $participant never appeared on $otherParticipant.")
})
}))
.map(_ => ())
}
expectedParties: Set[Party]): Future[Unit] =
participant.waitForParties(participants, expectedParties)

private[this] def nextParticipant(): ParticipantTestContext =
participantsRing.synchronized {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ object Synchronize {
for {
alice <- alpha.allocateParty()
bob <- beta.allocateParty()
_ <- alpha.waitForParties(Set(beta), Set(alice, bob))
_ <- beta.waitForParties(Set(alpha), Set(alice, bob))
factory <- alpha.create(alice, AgreementFactory(bob, alice))
agreement <- eventually { beta.exercise(bob, factory.exerciseCreateAgreement) }
_ <- eventually { alpha.transactionTreeById(agreement.transactionId, alice) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,23 @@ private[testtool] final class ParticipantTestContext private[participant] (
.listKnownParties(new ListKnownPartiesRequest())
.map(_.partyDetails.map(partyDetails => Party(partyDetails.party)).toSet)

def waitForParties(
otherParticipants: Iterable[ParticipantTestContext],
expectedParties: Set[Party]): Future[Unit] = {
val participants = otherParticipants.toSet + this
Future
.sequence(participants.map(otherParticipant => {
otherParticipant
.listParties()
.map(actualParties => {
assert(
expectedParties.subsetOf(actualParties),
s"Parties from $this never appeared on $otherParticipant.")
})
}))
.map(_ => ())
}

def activeContracts(
request: GetActiveContractsRequest): Future[(Option[LedgerOffset], Vector[CreatedEvent])] =
for {
Expand Down